From: Vaishnavi Kale Date: Tue, 19 Nov 2024 01:00:08 +0000 (-0700) Subject: Misc minor changes based on PR review X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db3c073609141b0c8efb097c84603432575348d4;p=dealii.git Misc minor changes based on PR review --- diff --git a/include/deal.II/grid/grid_in.h b/include/deal.II/grid/grid_in.h index cc25583cb8..20ecab5d36 100644 --- a/include/deal.II/grid/grid_in.h +++ b/include/deal.II/grid/grid_in.h @@ -768,6 +768,24 @@ public: static std::string get_format_names(); + /** + * Return a map containing field data associated with the elements of an + * external vtk format mesh imported using read_vtk(). + * The format of the returned map is as + * follows: + * - std::string stores the name of the field data (identifier) as specified + * in the external mesh + * - std::vector stores value for the given identifier in each cell. + * To access the value, use field_data[name_field][cell_id]. For example, if + * the vtk mesh contains field data 'Density' defined at the cells, + * field_data['Density'][0] would be the density defined at cell ID '0', + * which corresponds to index 0 of the vector. The length of the vector in + * field_data['Density'] would equal the number of elements in the coarse + * mesh. + */ + const std::map> & + get_field_data() const; + /** * Exception */ @@ -879,17 +897,6 @@ public: std::to_string(arg1) + " lines and " + std::to_string(arg2) + " facets (surface triangles or quadrilaterals)."); - /** - * Return a map containing field data. The format of the returned map is as - * follows: - * - std::string stores the name of the field data (identifier) as specified - * in the external mesh - * - std::vector stores value for the given identifier in each cell. - * To access the value use field_data[name_field][cell_id]. - */ - const std::map> & - get_field_data() const; - protected: /** * Store address of the triangulation to be fed with the data read in. @@ -962,11 +969,13 @@ private: Format default_format; /** - * Data member that stores cell data. The format is as follows: + * Data member that stores field data defined at the cells of the mesh. + * The format is as follows: * - std::string stores the name of the field data (identifier) as specified * in the external mesh * - std::vector stores value for the given identifier in each - * cell_id. To access the value use field_data[name_field][cell_id]. + * cell_id. + * To access the value use field_data[name_field][cell_id]. */ std::map> field_data; }; diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 3609794bc0..84054b8b19 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -467,8 +467,6 @@ GridIn::read_vtk(std::istream &in) for (unsigned int i = 0; i < data_sets.size(); ++i) { // Ignore everything until we get to a SCALARS data set - - std::cout << "keyword: " << keyword << std::endl; if (keyword == "SCALARS") { // Now see if we know about this type of data set, diff --git a/tests/grid/grid_in_vtk_2d_field_data.cc b/tests/grid/grid_in_vtk_2d_field_data.cc index c604cc5a0c..0cfc214d3e 100644 --- a/tests/grid/grid_in_vtk_2d_field_data.cc +++ b/tests/grid/grid_in_vtk_2d_field_data.cc @@ -61,7 +61,8 @@ check_file(const std::string name, typename GridIn::Format format) ++cell) { // store cell ID as a string - std::string text = boost::lexical_cast(cell->id()); + std::string text = boost::lexical_cast( + cell->id().get_coarse_cell_id()); // Convert the string containing cell ID to an integer boost::char_separator sep{"_"}; boost::tokenizer> tokens(text, sep);