]> https://gitweb.dealii.org/ - dealii.git/commitdiff
We do not need marker(no_of_markers). Reorder code.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Fri, 30 Sep 2005 16:46:50 +0000 (16:46 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Fri, 30 Sep 2005 16:46:50 +0000 (16:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@11562 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_in.cc

index 85e78bb77c3c5199a9ac9e6fe070aaaf262f20c1..3e1427fbb7dd48e87568d5a50b64c2a4d08feab3 100644 (file)
@@ -1135,55 +1135,12 @@ void GridIn<3>::read_netcdf (const std::string &filename)
     for (unsigned int i=0; i<vertices_per_hex; ++i)
       cells[cell].vertices[i]=vertex_indices[cell*vertices_per_hex+i];
 
-                                  // we read
-                                  //   int marker(no_of_markers)
-  NcDim *marker_dim=nc.get_dim("no_of_markers");
-  AssertThrow(marker_dim->is_valid(), ExcIO());
-  const unsigned int n_markers=marker_dim->size();
-
-  NcVar *marker_var=nc.get_var("marker");
-  AssertThrow(marker_var->is_valid(), ExcIO());
-  AssertThrow(marker_var->num_dims()==1, ExcIO());
-  AssertThrow(static_cast<unsigned int>(
-    marker_var->get_dim(0)->size())==n_markers, ExcIO());
-
-  std::vector<int> marker(n_markers);
-                                  // use &* to convert
-                                  // vector<int>::iterator to int *
-  marker_var->get(&*marker.begin(), n_markers);
-
-  if (output)
-    {
-      std::cout << "marker: ";
-      for (unsigned int i=0; i<n_markers; ++i)
-       std::cout << marker[i] << " ";
-      std::cout << std::endl;
-    }
-
-                                  // next we read
-                                  // int boundarymarker_of_surfaces(
-                                  //   no_of_surfaceelements)
-  NcDim *bquads_dim=nc.get_dim("no_of_surfacequadrilaterals");
-  AssertThrow(bquads_dim->is_valid(), ExcIO());
-  const unsigned int n_bquads=bquads_dim->size();
-
-  NcVar *bmarker_var=nc.get_var("boundarymarker_of_surfaces");
-  AssertThrow(bmarker_var->is_valid(), ExcIO());
-  AssertThrow(bmarker_var->num_dims()==1, ExcIO());
-  AssertThrow(static_cast<unsigned int>(
-    bmarker_var->get_dim(0)->size())==n_bquads, ExcIO());
-
-  std::vector<int> bmarker(n_bquads);
-  bmarker_var->get(&*bmarker.begin(), n_bquads);
-                                  // we only handle boundary
-                                  // indicators that fit into an
-                                  // unsigned char. Also, we don't
-                                  // take 255 as it denotes an
-                                  // internal face
-  for (unsigned int i=0; i<bmarker.size(); ++i)
-    Assert(0<=bmarker[i] && bmarker[i]<=254, ExcIO());
-
-                                  // next we read
+                                  // for setting up the SubCellData
+                                  // we read the vertex indices of
+                                  // the boundary quadrilaterals and
+                                  // their boundary markers
+  
+                                  // first we read
                                   // int points_of_surfacequadrilaterals(
                                   //   no_of_surfacequadrilaterals,
                                   //   points_per_surfacequadrilateral)
@@ -1195,8 +1152,7 @@ void GridIn<3>::read_netcdf (const std::string &filename)
   NcVar *bvertex_indices_var=nc.get_var("points_of_surfacequadrilaterals");
   AssertThrow(bvertex_indices_var->is_valid(), ExcIO());
   AssertThrow(bvertex_indices_var->num_dims()==2, ExcIO());
-  AssertThrow(static_cast<unsigned int>(
-    bvertex_indices_var->get_dim(0)->size())==n_bquads, ExcIO());
+  const unsigned int n_bquads=bvertex_indices_var->get_dim(0)->size();
   AssertThrow(static_cast<unsigned int>(
                bvertex_indices_var->get_dim(1)->size())==
              GeometryInfo<dim>::vertices_per_face, ExcIO());
@@ -1216,6 +1172,31 @@ void GridIn<3>::read_netcdf (const std::string &filename)
        }
     }
 
+                                  // next we read
+                                  // int boundarymarker_of_surfaces(
+                                  //   no_of_surfaceelements)
+  NcDim *bquads_dim=nc.get_dim("no_of_surfacequadrilaterals");
+  AssertThrow(bquads_dim->is_valid(), ExcIO());
+  AssertThrow(bquads_dim->size()==n_bquads, ExcIO());
+
+  NcVar *bmarker_var=nc.get_var("boundarymarker_of_surfaces");
+  AssertThrow(bmarker_var->is_valid(), ExcIO());
+  AssertThrow(bmarker_var->num_dims()==1, ExcIO());
+  AssertThrow(static_cast<unsigned int>(
+    bmarker_var->get_dim(0)->size())==n_bquads, ExcIO());
+
+  std::vector<int> bmarker(n_bquads);
+  bmarker_var->get(&*bmarker.begin(), n_bquads);
+                                  // we only handle boundary
+                                  // indicators that fit into an
+                                  // unsigned char. Also, we don't
+                                  // take 255 as it denotes an
+                                  // internal face
+  for (unsigned int i=0; i<bmarker.size(); ++i)
+    Assert(0<=bmarker[i] && bmarker[i]<=254, ExcIO());
+
+                                  // finally we setup the boundary
+                                  // information
   SubCellData subcelldata;
   subcelldata.boundary_quads.resize(n_bquads);
   for (unsigned int i=0; i<n_bquads; ++i)

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.