[MOAB-dev] commit/MOAB: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Jul 10 17:27:01 CDT 2014


2 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/666986dff22d/
Changeset:   666986dff22d
Branch:      None
User:        iulian07
Date:        2014-07-10 21:27:11
Summary:     add option for faces and edges

it will create faces and edges too, and output them to the file
They will not be part of parallel partition

Affected #:  1 file

diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 5918a09..25cbaa0 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -70,6 +70,7 @@ int main(int argc, char **argv)
   bool quadratic=false;
   bool keep_skins=false;
   bool tetra = false;
+  bool adjEnts = false;
 
   MPI_Init(&argc, &argv);
 
@@ -103,6 +104,8 @@ int main(int argc, char **argv)
   opts.addOpt<void>("tetrahedrons,t", "generate tetrahedrons ",
         &tetra);
 
+  opts.addOpt<void>("faces_edges,f", "create all faces and edges", &adjEnts);
+
   vector<string> intTagNames;
   string firstIntTag;
   opts.addOpt<string>(std::string("int_tag_vert,i"), string("add integer tag on vertices"), &firstIntTag);
@@ -143,6 +146,10 @@ int main(int argc, char **argv)
     return 1;
   }
 
+  if (adjEnts)
+  {
+    keep_skins = true; // do not delete anything
+  }
   // determine m, n, k for processor rank
   int m,n,k;
   k = rank/(M*N);
@@ -473,6 +480,15 @@ int main(int argc, char **argv)
      tt = clock();
   }
 
+  if (adjEnts)
+  {
+    // generate all adj entities dimension 1 and 2 (edges and faces/ tri or quads)
+    Range edges, faces;
+    rval = mb->get_adjacencies(all3dcells, 1, true, edges, Interface::UNION );
+    CHECKE("Can't get edges");
+    rval = mb->get_adjacencies(all3dcells, 2, true, faces, Interface::UNION );
+    CHECKE("Can't get faces");
+  }
   ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
   if (pcomm==NULL)
   {


https://bitbucket.org/fathomteam/moab/commits/469ad6916df4/
Changeset:   469ad6916df4
Branch:      iulian07/largemesh
User:        iulian07
Date:        2014-07-11 00:24:29
Summary:     the edges and faces should be added to the partition

if created, it would be better to put the edges and faces to their partitions
for this, create them early, in the loop
Need to update adjacencies, otherwise next time in the loop it does not work
(to create edges and faces based on adjacencies)
it is the n-th time I made this mistake :(

Affected #:  1 file

diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 25cbaa0..4ec1e1b 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -267,16 +267,23 @@ int main(int argc, char **argv)
 
         EntityHandle starte; // connectivity
         EntityHandle * conn;
+        int num_v_per_elem = 8;
         if (quadratic)
+        {
+          num_v_per_elem = 27;
           rval = iface->get_element_connect(num_el, 27, MBHEX, 0, starte, conn);
+        }
         else if (tetra)
+        {
+          num_v_per_elem = 4;
           rval = iface->get_element_connect(num_el, 4, MBTET, 0, starte, conn);
+        }
         else
           rval = iface->get_element_connect(num_el, 8, MBHEX, 0, starte, conn);
         CHECKE("Can't get element  connectivity.");
 
-        Range hexas(starte, starte+num_el-1); // should be elements
-        // fill  hexas
+        Range cells(starte, starte+num_el-1); // should be elements
+        // fill  cells
         ix=0;
         // identify the elements at the lower corner, for their global ids
         int xe = m*A*blockSize + a*blockSize;
@@ -432,9 +439,28 @@ int main(int argc, char **argv)
         EntityHandle part_set;
         rval = mb->create_meshset(MESHSET_SET, part_set);
         CHECKE("Can't create mesh set.");
-        rval = mb->add_entities(part_set, hexas);
+        rval = mb->add_entities(part_set, cells);
         CHECKE("Can't add entities to set.");
-        rval = mb->tag_set_data(global_id_tag, hexas, &gids[0]);
+        // if needed, add all edges and faces
+        if (adjEnts)
+        {
+          // we need to update adjacencies now, because some elements are new
+          rval = iface->update_adjacencies(starte, num_el, num_v_per_elem, conn);
+          CHECKE("Can't update adjacencies");
+          // generate all adj entities dimension 1 and 2 (edges and faces/ tri or qua
+          Range edges, faces;
+          rval = mb->get_adjacencies(cells, 1, true, edges,
+              Interface::UNION);
+          CHECKE("Can't get edges");
+          rval = mb->get_adjacencies(cells, 2, true, faces,
+              Interface::UNION);
+          CHECKE("Can't get faces");
+          rval = mb->add_entities(part_set, edges);
+          CHECKE("Can't add edges to partition set.");
+          rval = mb->add_entities(part_set, faces);
+          CHECKE("Can't add faces to partition set.");
+        }
+        rval = mb->tag_set_data(global_id_tag, cells, &gids[0]);
         CHECKE("Can't set global ids to elements.");
         int part_num= a +  m*A + (b + n*B)*(M*A) + (c+k*C)*(M*A * N*B);
         rval = mb->tag_set_data(part_tag, &part_set, 1, &part_num);
@@ -480,15 +506,6 @@ int main(int argc, char **argv)
      tt = clock();
   }
 
-  if (adjEnts)
-  {
-    // generate all adj entities dimension 1 and 2 (edges and faces/ tri or quads)
-    Range edges, faces;
-    rval = mb->get_adjacencies(all3dcells, 1, true, edges, Interface::UNION );
-    CHECKE("Can't get edges");
-    rval = mb->get_adjacencies(all3dcells, 2, true, faces, Interface::UNION );
-    CHECKE("Can't get faces");
-  }
   ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
   if (pcomm==NULL)
   {

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list