Flow123d
JS_before_hm-1830-gb19ac973c
|
Go to the documentation of this file.
34 : element_data_values_(element_data_values),
39 std::shared_ptr<BaseMeshReader> reader_ptr;
41 reader_ptr = std::make_shared<GmshMeshReader>(file_name);
42 }
else if ( file_name.
extension() ==
".vtu" ) {
43 reader_ptr = std::make_shared<VtkMeshReader>(file_name);
44 }
else if ( file_name.
extension() ==
".pvd" ) {
45 reader_ptr = std::make_shared<PvdMeshReader>(file_name);
47 THROW(ExcWrongExtension() << EI_FileExtension(file_name.
extension()) << EI_MeshFile((
string)file_name) );
56 Mesh * mesh =
new Mesh( input_mesh_rec );
59 auto file = input_mesh_rec.
val<
FilePath>(
"mesh_file");
61 reader->read_physical_names(mesh);
62 if (input_mesh_rec.
opt_val(
"regions", region_list)) {
65 reader->read_raw_mesh(mesh);
66 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, input_mesh_rec)
75 ASSERT(mesh).error(
"Argument mesh is NULL.\n");
76 tok_.set_position( Tokenizer::Position() );
90 bool boundary_domain,
unsigned int component_idx) {
92 .error(
"Vector of mapping VTK to GMSH element is not initialized. Did you call check_compatible_mesh?");
99 (*element_data_values_)[field_name] = std::make_shared< ElementDataCache<T> >();
104 unsigned int size_of_cache;
108 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of entities: {}, using {} instead.\n",
113 if (n_components == 1) {
122 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of components: {}, using {} instead.\n",
128 (*element_data_values_)[field_name]
129 = std::make_shared< ElementDataCache<T> >(field_name,
actual_header_.
time, size_of_cache, n_components*n_entities);
135 if (component_idx == std::numeric_limits<unsigned int>::max() ||
143 double upper_bound) {
147 std::shared_ptr< ElementDataCache<double> > current_cache = dynamic_pointer_cast<ElementDataCache<double> >(
it->second);
148 ASSERT(current_cache)(field_name).error(
"scale_and_check_limits can be call only for scalable fields!\n");
150 CheckResult check_val = current_cache->check_values(default_val, lower_bound, upper_bound);
151 current_cache->scale_data(coef);
158 #define MESH_READER_GET_ELEMENT_DATA(TYPE) \
159 template typename ElementDataCache<TYPE>::ComponentDataPtr BaseMeshReader::get_element_data<TYPE>(unsigned int n_entities, \
160 unsigned int n_components, bool boundary_domain, unsigned int component_idx);
MeshDataHeader actual_header_
Header of actual loaded data.
Tokenizer tok_
Tokenizer used for reading ASCII file format.
#define MESH_READER_GET_ELEMENT_DATA(TYPE)
CheckResult scale_and_check_limits(string field_name, double coef, double default_val, double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
virtual void read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain)=0
vector< LongIdx > boundary_elements_id_
static std::shared_ptr< BaseMeshReader > reader_factory(const FilePath &file_name)
ComponentDataPtr get_component_data(unsigned int component_idx)
Return vector of element data for get component.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Dedicated class for storing path to input and output files.
virtual void read_nodes(Mesh *mesh)=0
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
void read_regions_from_input(Input::Array region_list)
const std::vector< int > & get_element_vector(bool boundary_domain)
std::shared_ptr< ElementDataFieldMap > element_data_values_
Cache with last read element data.
static Mesh * mesh_factory(const Input::Record &input_mesh_rec)
CheckResult
Return type of method that checked data stored in ElementDataCache (NaN values, limits)
bool can_have_components_
BaseMeshReader(const FilePath &file_name)
Constructor.
ElementDataCache< T >::ComponentDataPtr get_element_data(unsigned int n_entities, unsigned int n_components, bool boundary_domain, unsigned int component_idx)
std::shared_ptr< std::vector< T > > ComponentDataPtr
virtual void read_elements(Mesh *mesh)=0
#define WarningOut()
Macro defining 'warning' record of log.
void read_raw_mesh(Mesh *mesh)
std::string data_section_name_
Store name of field data section specify for type of mesh file.
bool has_compatible_mesh_
#define START_TIMER(tag)
Starts a timer with specified tag.
vector< LongIdx > bulk_elements_id_