]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Misc minor changes based on PR review
authorVaishnavi Kale <vaishnav@ualberta.ca>
Tue, 19 Nov 2024 01:00:08 +0000 (18:00 -0700)
committerVaishnavi Kale <vaishnav@ualberta.ca>
Tue, 19 Nov 2024 20:12:34 +0000 (13:12 -0700)
include/deal.II/grid/grid_in.h
source/grid/grid_in.cc
tests/grid/grid_in_vtk_2d_field_data.cc

index cc25583cb8c281e2a750b02c807903972a525d89..20ecab5d366211a717991a57c4f062e0f6a31f0f 100644 (file)
@@ -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<double> 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<std::string, std::vector<double>> &
+  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<double> stores value for the given identifier in each cell.
-   * To access the value use field_data[name_field][cell_id].
-   */
-  const std::map<std::string, std::vector<double>> &
-  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<double> 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<std::string, std::vector<double>> field_data;
 };
index 3609794bc0057ca252cd58e71b6f87dce877de4b..84054b8b1925477d54bba510597e9d69f6046b33 100644 (file)
@@ -467,8 +467,6 @@ GridIn<dim, spacedim>::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,
index c604cc5a0c96762c71ecf583fc401fc625a7d5b6..0cfc214d3eed386546d5862d3917e8efb224d9ff 100644 (file)
@@ -61,7 +61,8 @@ check_file(const std::string name, typename GridIn<dim>::Format format)
                ++cell)
             {
               // store cell ID as a string
-              std::string text = boost::lexical_cast<std::string>(cell->id());
+              std::string text = boost::lexical_cast<std::string>(
+                cell->id().get_coarse_cell_id());
               // Convert the string containing cell ID to an integer
               boost::char_separator<char>                   sep{"_"};
               boost::tokenizer<boost::char_separator<char>> tokens(text, sep);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.