[MOAB-dev] commit/MOAB: tautges: - make HelloMOAB generic to face/element type

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Jul 27 13:28:51 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/52bde6e3358c/
Changeset:   52bde6e3358c
Branch:      master
User:        tautges
Date:        2013-07-27 20:28:38
Summary:     - make HelloMOAB generic to face/element type
- add a 'clean' target to examples makefile
- in Coupler.cpp, initialize a field to avoid valgrind message about unassigned variable

Affected #:  3 files

diff --git a/examples/HelloMOAB.cpp b/examples/HelloMOAB.cpp
index ebab971..11bbc81 100644
--- a/examples/HelloMOAB.cpp
+++ b/examples/HelloMOAB.cpp
@@ -14,6 +14,10 @@
 using namespace moab;
 using namespace std;
 
+#ifndef MESH_DIR
+#define MESH_DIR "."
+#endif
+
 string test_file_name = string(MESH_DIR) + string("/3k-tri-sphere.vtk");
 
 int main( int argc, char** argv )
@@ -27,38 +31,32 @@ int main( int argc, char** argv )
   }  
     //load the mesh from vtk file
   ErrorCode rval = iface->load_mesh( test_file_name.c_str() );
-  assert( rval == MB_SUCCESS);
+  assert(rval == MB_SUCCESS);
 
-    //get verts entities
+    // get verts entities, by type
   Range verts;
   rval = iface->get_entities_by_type(0, MBVERTEX, verts);
-  assert( rval == MB_SUCCESS);
-    //get edge entities
+  assert(rval == MB_SUCCESS);
+    //get edge entities, by type
   Range edges;
   rval = iface->get_entities_by_type(0, MBEDGE, edges);
   assert(rval == MB_SUCCESS);
 
-    //get triangular entities
-  Range tri;
-  rval = iface->get_entities_by_type(0, MBTRI, tri);
-  assert( rval == MB_SUCCESS);
-
-    //get quad entities
-  Range quads;
-  rval = iface->get_entities_by_type(0, MBQUAD, quads);
+    // get faces, by dimension, so we stay generic to entity type
+  Range faces;
+  rval = iface->get_entities_by_dimension(0, 2, faces);
   assert(rval == MB_SUCCESS);
 
-    //get hex entities
-  Range hex;
-  rval = iface->get_entities_by_type(0, MBHEX, hex);
+    //get regions, by dimension, so we stay generic to entity type
+  Range elems;
+  rval = iface->get_entities_by_dimension(0, 3, elems);
   assert(rval == MB_SUCCESS);
 
    //output the number of entities
   cout << "Number of vertices is " << verts.size() <<  endl;
   cout << "Number of edges is " << edges.size() <<  endl;
-  cout << "Number of triangular faces is " << tri.size() <<  endl;
-  cout << "Number of quad faces is " << quads.size() <<  endl;
-  cout << "Number of hex is " << hex.size() <<  endl;
+  cout << "Number of faces is " << faces.size() <<  endl;
+  cout << "Number of elements is " << elems.size() <<  endl;
   
   return 0;
 }

diff --git a/examples/makefile b/examples/makefile
index 3402f96..865b390 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -7,6 +7,12 @@ include ${MOAB_DIR}/lib/iMesh-Defs.inc
 # MESH_DIR is the top-level MOAB source directory, used to locate mesh files that come with MOAB source
 MESH_DIR="../MeshFiles/unittest"
 
+EXAMPLES = StructuredMeshSimple HelloMOAB DirectAccessWithHoles DirectAccessNoHoles
+PAREXAMPLES = HelloParMOAB ReduceExchangeTags
+EXOIIEXAMPLES = TestExodusII
+
+default: ${EXAMPLES}
+
 StructuredMeshSimple : StructuredMeshSimple.o
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} 
 
@@ -31,6 +37,9 @@ DirectAccessNoHoles: DirectAccessNoHoles.o
 DirectAccessNoHolesF90: DirectAccessNoHolesF90.o
 	${MOAB_CXX} -o $@ $< ${IMESH_LIBS}
 
+clean:
+	rm -rf *.o ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES}
+
 .cpp.o :
 	${MOAB_CXX} ${MOAB_CXXFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
 

diff --git a/tools/mbcoupler/Coupler.cpp b/tools/mbcoupler/Coupler.cpp
index 7458bad..7f9a3f6 100644
--- a/tools/mbcoupler/Coupler.cpp
+++ b/tools/mbcoupler/Coupler.cpp
@@ -549,6 +549,7 @@ ErrorCode Coupler::interpolate(Coupler::Method *methods,
       tinterp.vi_wr[5*t+2] = tl_tmp->vi_rd[3*t+2];
       tinterp.vi_wr[5*t+3] = methods[i];
       tinterp.vi_wr[5*t+4] = i;
+      tinterp.vr_wr[t] = 0.0;
       tinterp.inc_n();
       t++;
     }

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