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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Apr 16 12:40:15 CDT 2013


3 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/059c733f4578/
Changeset:   059c733f4578
Branch:      None
User:        iulian07
Date:        2013-04-11 04:58:55
Summary:     Merged fathomteam/moab into master
Affected #:  5 files

diff --git a/.gitignore b/.gitignore
index 6b35368..6d29b5e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,11 @@
 MOABConfig.cmake
+moab.files
+config/test-driver
 moab.config
+moab.includes
+moab.creator*
+*.ccm
+*.cub
 aclocal.m4
 autom4te.cache/
 config.h
@@ -68,6 +74,7 @@ share/*
 bin/*
 *~
 examples/HelloMoabPar
+examples/TestExodusII
 itaps/igeom/FBiGeom_protos.h
 itaps/igeom/testSmooth2
 itaps/igeom/testSmoothGeom
@@ -175,4 +182,6 @@ tools/mbcslam/spectral.vtk
 tools/mbcslam/spherical_area_test
 .project
 .cproject
+examples/*.h5m
+examples/ReduceExchangeTags
 

diff --git a/examples/HelloMoabPar.cpp b/examples/HelloMoabPar.cpp
index cf308a7..a5a71aa 100644
--- a/examples/HelloMoabPar.cpp
+++ b/examples/HelloMoabPar.cpp
@@ -1,18 +1,18 @@
 /** @example HelloMoabPar.cpp \n
  * \brief Read mesh into MOAB in parallel \n
- * This example shows the simplest way of telling MOAB to read in parallel. \n
+ * This example shows the simplest way of telling MOAB to read in parallel.
  *
- * 0. Initialize MPI and get the rank and number of processors \n
- * 1. Process arguments (file name and options for parallel read) \n
- * 2. Initialize MOAB \n
- * 3. Load a partitioned file in parallel; \n
- * 4. retrieve shared entities on each processor \n
- * 5. Filter owned entities among shared ones on each processor \n
- * 6. Exchange ghost layers, and repeat the reports \n
+ *    -#  Initialize MPI and get the rank and number of processors \n
+ *    -#  Process arguments (file name and options for parallel read) \n
+ *    -#  Initialize MOAB \n
+ *    -#  Load a partitioned file in parallel; \n
+ *    -#  retrieve shared entities on each processor \n
+ *    -#  Filter owned entities among shared ones on each processor \n
+ *    -#  Exchange ghost layers, and repeat the reports \n
  *
- * To compile: \n
+ * <b>To compile</b>: \n
  *    make HelloMoabPar MOAB_DIR=<installdir>  \n
- * To run: mpiexec -np 4 HelloMoabPar \n
+ * <b>To run</b>: mpiexec -np 4 HelloMoabPar \n
  *  (depending on your configuration, LD_LIBRARY_PATH may need to contain <hdf5>/lib folder)
  *
  */

diff --git a/examples/ReduceExchangeTags.cpp b/examples/ReduceExchangeTags.cpp
index 3c0b43e..6c2e7de 100644
--- a/examples/ReduceExchangeTags.cpp
+++ b/examples/ReduceExchangeTags.cpp
@@ -1,186 +1,228 @@
-// A test file for Subset Normalization
-#include "moab/ParallelComm.hpp"
-#include "MBParallelConventions.h"
-#include "moab/Core.hpp"
-#include <iostream>
-#include <sstream>
-#include <cstdlib>
-
-using namespace moab;
-
-bool debug = true;
-
-// Error routines for use with MOAB API
-#define CHKERR(CODE, MSG)                                 \
-  do {                                                    \
-    if (MB_SUCCESS != (CODE)) {                           \
-      std::string errstr;  mbi->get_last_error(errstr);   \
-      std::cerr << errstr << std::endl;                   \
-      std::cerr << MSG << std::endl;                      \
-      MPI_Finalize();                                     \
-    }                                                     \
-  } while(false)
-
-// Error routines for use with MPI API
-#define MPICHKERR(CODE, MSG)                              \
-  do {                                                    \
-    if (0 != CODE) {                                      \
-      std::cerr << MSG << std::endl;                      \
-      MPI_Finalize();                                     \
-    }                                                     \
-  } while(false)
-
-
-// Function to parse input parameters
-ErrorCode get_file_options(int argc, char **argv,
-                           const char** filename,
-                           const char** tagName,
-                           double &tagValues)
-{
-  int npos = 1;
-
-  assert(argc >= 2);
-
-  // get mesh filename
-  *filename = argv[npos++];
-
-  // get tag selection options
-  if (argc > 3) {
-    *tagName = argv[npos++];
-    tagValues = atof(argv[npos++]);
-  }
-  else {
-    *tagName = "USERTAG";
-    tagValues = 1.0;
-  }
-
-  return MB_SUCCESS;
-}
-
-#define dbgprint(MSG)                                \
-  do {                                              \
-      if (!rank) std::cerr << MSG << std::endl;     \
-  } while(false)
-
-//
-// Start of main test program
-//
-int main(int argc, char **argv)
-{
-  ErrorCode err;
-  int ierr, rank;
-  const char *filename, *tagName;
-  double tagValue;
-  MPI_Comm comm = MPI_COMM_WORLD;
-  std::string read_options = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION_DISTRIBUTE;PARALLEL_GHOSTS=3.0.1;PARALLEL_COMM=0";
-
-  // Initialize MPI first
-  ierr = MPI_Init(&argc, &argv);
-  MPICHKERR(ierr, "MPI_Init failed");
-
-  // Print usage if not enough arguments
-  if (argc < 2) {
-    std::cerr << "Usage: ";
-    std::cerr << argv[0] << " <file_name><tag_name><tag_value>" << std::endl;
-    std::cerr << "file_name    : mesh file name" << std::endl;
-    std::cerr << "tag_name     : name of tag to add to mesh" << std::endl;
-    std::cerr << "tag_value    : a double valued string to set for highest-dimensional entities in the mesh for the named tag" << std::endl;
-
-    ierr = MPI_Finalize();
-    MPICHKERR(ierr, "MPI_Finalize failed; Aborting");
-
-    return 1;
-  }
-
-  ierr = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-  MPICHKERR(ierr, "MPI_Comm_rank failed");
-
-  // Create the moab instance
-  Interface *mbi = new Core();
-  CHKERR(NULL == mbi, "MOAB constructor failed");
-
-  // Get the input options
-  dbgprint( "Getting options..." );
-  err = get_file_options(argc, argv, &filename, &tagName, tagValue);
-  CHKERR(err, "get_file_options failed");
-
-  // Print out the input parameters
-  dbgprint( "    Input Parameters - " );
-  dbgprint( "      Filenames: " << filename );
-  dbgprint( "      Tag: Name=" << tagName << " Value=" << tagValue );
-
-  // Create root sets for each mesh.  Then pass these
-  // to the load_file functions to be populated.
-  EntityHandle rootset, partnset;
-  err = mbi->create_meshset(MESHSET_SET, rootset);
-  CHKERR(err, "Creating root set failed");
-  err = mbi->create_meshset(MESHSET_SET, partnset);
-  CHKERR(err, "Creating partition set failed");
-
-  // Create the parallel communicator object with the partition handle associated with MOAB
-  ParallelComm *parallel_communicator = ParallelComm::get_pcomm( mbi, partnset, &comm );
-
-  // Load the file from disk with given options
-  err = mbi->load_file( filename, &rootset, read_options.c_str() );
-  CHKERR(err, "MOAB::load_file failed");
-
-  // Get tag handles for passed in tags
-  dbgprint( "Getting tag handle " << tagName << "..." );
-  Tag tagReduce, tagExchange;
-  {
-    std::stringstream sstr;
-    sstr << tagName << "_RED";
-    err = mbi->tag_get_handle(sstr.str().c_str(), 1, MB_TYPE_DOUBLE, tagReduce, MB_TAG_CREAT|MB_TAG_DENSE, &tagValue);
-    CHKERR(err, "Retrieving tag handles failed");
-    sstr.str(""); sstr << tagName << "_EXC";
-    err = mbi->tag_get_handle(sstr.str().c_str(), 1, MB_TYPE_INTEGER, tagExchange, MB_TAG_CREAT|MB_TAG_DENSE, &tagValue);
-    CHKERR(err, "Retrieving tag handles failed");
-  }
-
-  // Set local tag data for reduction
-  {
-    Range partEnts;
-    err = parallel_communicator->get_part_entities(partEnts);
-    CHKERR(err, "ParallelComm::get_part_entities failed");
-    // Output what is in current partition sets
-    std::cout << "[" << rank << "]: Number of Partitioned entities: " <<  partEnts.size() << std::endl;
-    MPI_Barrier(comm);
-
-    std::vector<double> tagValues(partEnts.size(), tagValue*(rank+1));
-    err = mbi->tag_set_data(tagReduce, partEnts, &tagValues[0]);
-    CHKERR(err, "Setting local tag data failed during reduce phase");
-
-    Range dummy;
-    dbgprint( "Reducing tags between processors " );
-    err = parallel_communicator->reduce_tags(tagReduce, MPI_SUM, dummy/*partEnts*/);
-    CHKERR(err, "Reducing tags between processors failed");
-
-    partEnts.clear();
-  }
-
-  // Set local tag data for exchange
-  {
-    Range partEnts, dimEnts;
-    for (int dim = 0; dim <= 2; dim++) {
-      err = mbi->get_entities_by_dimension(rootset, dim, dimEnts, false);
-      std::vector<int> tagValues(dimEnts.size(), static_cast<int>(tagValue)*(rank+1)*(dim+1));
-      err = mbi->tag_set_data(tagExchange, dimEnts, &tagValues[0]);
-      CHKERR(err, "Setting local tag data failed during exchange phase");
-      partEnts.merge(dimEnts);
-    }
-
-    dbgprint( "Exchanging tags between processors " );
-    err = parallel_communicator->exchange_tags(tagExchange, partEnts);
-    CHKERR(err, "Exchanging tags between processors failed");
-  }
-
-  // Write out to output file to visualize reduction/exchange of tag data
-  mbi->write_file("test.h5m", "H5M", "PARALLEL=WRITE_PART");
-
-  // Done, cleanup
-  delete mbi;
-
-  dbgprint( "********** reduce_exchange_tags DONE! **********" );
-  MPI_Finalize();
-  return 0;
-}
+/** @example ReduceExchangeTags.cpp
+ * \brief Example program that shows the use case for performing tag data exchange
+ * between parallel processors in order to sync data on shared entities. The reduction
+ * operation on tag data is also shown where the user can perform any of the actions supported
+ * by MPI_Op on data residing on shared entities. \n
+ *
+ * <b>This example </b>:
+ *    -# Initialize MPI and instantiate MOAB
+ *    -# Get user options: Input mesh file name, tag name (default: USERTAG), tag value (default: 1.0)
+ *    -# Create the root and partition sets
+ *    -# Instantiate ParallelComm and read the mesh file in parallel using appropriate options
+ *    -# Create two tags: USERTAG_EXC (exchange) and USERTAG_RED (reduction)
+ *    -# Set tag data and exchange shared entity information between processors
+ *      -# Get entities in all dimensions and set local (current rank, dimension) dependent data for
+ *     exchange tag (USERTAG_EXC)
+ *      -# Perform exchange of tag data so that data on shared entities are synced via ParallelCommunicator.
+ *    -#  Set tag data and reduce shared entity information between processors using MPI_SUM
+ *      -#  Get higher dimensional entities in the current partition and set local (current rank)
+ *     dependent data for reduce tag (USERTAG_EXC)
+ *      -#  Perform the reduction operation (MPI_SUM) on shared entities via ParallelCommunicator.
+ *    -#  Destroy the MOAB instance and finalize MPI
+ *
+ * <b>To run:</b> \n mpiexec -n 2 ./ReduceExchangeTags <mesh_file><tag_name><tag_value> \n
+ * <b>Example:</b> \n mpiexec -n 2 ./ReduceExchangeTags ../MeshFiles/unittest/64bricks_1khex.h5m USERTAG 100 \n
+ *
+ */
+
+#include "moab/ParallelComm.hpp"
+#include "MBParallelConventions.h"
+#include "moab/Core.hpp"
+#include <iostream>
+#include <string>
+#include <sstream>
+
+using namespace moab;
+
+// Error routines for use with MOAB API
+#define CHKERR(CODE, MSG)                                 \
+  do {                                                    \
+    if (MB_SUCCESS != (CODE)) {                           \
+      std::string errstr;  mbi->get_last_error(errstr);   \
+      std::cerr << errstr << std::endl;                   \
+      std::cerr << MSG << std::endl;                      \
+      MPI_Finalize();                                     \
+    }                                                     \
+  } while(false)
+
+// Error routines for use with MPI API
+#define MPICHKERR(CODE, MSG)                              \
+  do {                                                    \
+    if (0 != CODE) {                                      \
+      std::cerr << MSG << std::endl;                      \
+      MPI_Finalize();                                     \
+    }                                                     \
+  } while(false)
+
+#define dbgprint(MSG)                                \
+  do {                                              \
+      if (!rank) std::cerr << MSG << std::endl;     \
+  } while(false)
+
+#define dbgprintall(MSG)                                      \
+  do {                                                        \
+      std::cerr << "[" << rank << "]: " << MSG << std::endl;  \
+  } while(false)
+
+
+// Function to parse input parameters
+ErrorCode get_file_options(int argc, char **argv,
+                           std::string& filename,
+                           std::string& tagName,
+                           double&      tagValues)
+{
+  // get mesh filename
+  if (argc > 1) filename = std::string(argv[1]);
+  else filename = std::string(MESH_DIR) + std::string("/64bricks_1khex.h5m");
+
+  // get tag selection options
+  if (argc > 2) tagName = std::string(argv[2]);
+  else tagName = "USERTAG";
+
+  if (argc > 3)  tagValues = atof(argv[3]);
+  else tagValues = 1.0;
+
+  return MB_SUCCESS;
+}
+
+//
+// Start of main test program
+//
+int main(int argc, char **argv)
+{
+  ErrorCode err;
+  int ierr, rank;
+  std::string filename, tagName;
+  double tagValue;
+  MPI_Comm comm = MPI_COMM_WORLD;
+  /// Parallel Read options:
+  ///   PARALLEL = type {READ_PART}
+  ///   PARTITION = PARALLEL_PARTITION : Partition as you read
+  ///   PARALLEL_RESOLVE_SHARED_ENTS : Communicate to all processors to get the shared adjacencies consistently in parallel
+  ///   PARALLEL_GHOSTS : a.b.c
+  ///                   : a = 3 - highest dimension of entities
+  ///                   : b = 0 -
+  ///                   : c = 1 - number of layers
+  ///   PARALLEL_COMM = index
+  std::string read_options = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION_DISTRIBUTE;PARALLEL_GHOSTS=3.0.1;PARALLEL_COMM=0";
+
+  // Print usage if not enough arguments
+  if (argc < 1) {
+    std::cerr << "Usage: ";
+    std::cerr << argv[0] << " <file_name><tag_name><tag_value>" << std::endl;
+    std::cerr << "file_name    : mesh file name" << std::endl;
+    std::cerr << "tag_name     : name of tag to add to mesh" << std::endl;
+    std::cerr << "tag_value    : a double valued string to set for highest-dimensional entities in the mesh for the named tag" << std::endl;
+
+    ierr = MPI_Finalize();
+    MPICHKERR(ierr, "MPI_Finalize failed; Aborting");
+
+    return 1;
+  }
+
+  // Initialize MPI first
+  ierr = MPI_Init(&argc, &argv);
+  MPICHKERR(ierr, "MPI_Init failed");
+
+  ierr = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPICHKERR(ierr, "MPI_Comm_rank failed");
+
+  dbgprint( "********** reduce_exchange_tags **********\n" );
+
+  // Create the moab instance
+  Interface *mbi = new Core();
+  CHKERR(NULL == mbi, "MOAB constructor failed");
+
+  // Get the input options
+  err = get_file_options(argc, argv, filename, tagName, tagValue);
+  CHKERR(err, "get_file_options failed");
+
+  // Print out the input parameters
+  dbgprint( " Input Parameters - " );
+  dbgprint( "   Filenames: " << filename );
+  dbgprint( "   Tag: Name=" << tagName << " Value=" << tagValue << std::endl );
+
+  // Create root sets for each mesh.  Then pass these
+  // to the load_file functions to be populated.
+  EntityHandle rootset, partnset;
+  err = mbi->create_meshset(MESHSET_SET, rootset);
+  CHKERR(err, "Creating root set failed");
+  err = mbi->create_meshset(MESHSET_SET, partnset);
+  CHKERR(err, "Creating partition set failed");
+
+  // Create the parallel communicator object with the partition handle associated with MOAB
+  ParallelComm *parallel_communicator = ParallelComm::get_pcomm( mbi, partnset, &comm );
+
+  // Load the file from disk with given options
+  err = mbi->load_file( filename.c_str(), &rootset, read_options.c_str() );
+  CHKERR(err, "MOAB::load_file failed");
+
+  // Create two tag handles: Exchange and Reduction operations
+  dbgprint( "-Creating tag handle " << tagName << "..." );
+  Tag tagReduce, tagExchange;
+  {
+    std::stringstream sstr;
+    // Create the exchange tag: default name = USERTAG_EXC
+    sstr << tagName << "_EXC";
+    err = mbi->tag_get_handle(sstr.str().c_str(), 1, MB_TYPE_INTEGER, tagExchange, MB_TAG_CREAT|MB_TAG_DENSE, &tagValue);
+    CHKERR(err, "Retrieving tag handles failed");
+
+    // Create the exchange tag: default name = USERTAG_RED
+    sstr.str(""); sstr << tagName << "_RED";
+    err = mbi->tag_get_handle(sstr.str().c_str(), 1, MB_TYPE_DOUBLE, tagReduce, MB_TAG_CREAT|MB_TAG_DENSE, &tagValue);
+    CHKERR(err, "Retrieving tag handles failed");
+  }
+
+  // Perform exchange tag data
+  dbgprint( "-Exchanging tags between processors " );
+  {
+    Range partEnts, dimEnts;
+    for (int dim = 0; dim <= 3; dim++) {
+      // Get all entities of dimension = dim
+      err = mbi->get_entities_by_dimension(rootset, dim, dimEnts, false);
+
+      std::vector<int> tagValues(dimEnts.size(), static_cast<int>(tagValue)*(rank+1)*(dim+1));
+      // Set local tag data for exchange
+      err = mbi->tag_set_data(tagExchange, dimEnts, &tagValues[0]);
+      CHKERR(err, "Setting local tag data failed during exchange phase");
+      // Merge entities into parent set
+      partEnts.merge(dimEnts);
+    }
+
+    // Exchange tags between processors
+    err = parallel_communicator->exchange_tags(tagExchange, partEnts);
+    CHKERR(err, "Exchanging tags between processors failed");
+  }
+
+  // Perform reduction of tag data
+  dbgprint( "-Reducing tags between processors " );
+  {
+    Range partEnts;
+    // Get all higher dimensional entities belonging to current partition
+    err = parallel_communicator->get_part_entities(partEnts);
+    CHKERR(err, "ParallelComm::get_part_entities failed");
+
+    // Output what is in current partition sets
+    dbgprintall( "Number of Partitioned entities: " <<  partEnts.size() );
+    MPI_Barrier(comm);
+
+    // Set local tag data for reduction
+    std::vector<double> tagValues(partEnts.size(), tagValue*(rank+1));
+    err = mbi->tag_set_data(tagReduce, partEnts, &tagValues[0]);
+    CHKERR(err, "Setting local tag data failed during reduce phase");
+
+    Range dummy;
+    // Reduce tag data using MPI_SUM on the interface between partitions
+    err = parallel_communicator->reduce_tags(tagReduce, MPI_SUM, dummy/*partEnts*/);
+    CHKERR(err, "Reducing tags between processors failed");
+  }
+  // Write out to output file to visualize reduction/exchange of tag data
+  mbi->write_file("test.h5m", "H5M", "PARALLEL=WRITE_PART");
+
+  // Done, cleanup
+  delete mbi;
+
+  dbgprint( "\n********** reduce_exchange_tags DONE! **********" );
+  MPI_Finalize();
+  return 0;
+}

diff --git a/examples/TestExodusII.cpp b/examples/TestExodusII.cpp
index d353117..c425f66 100644
--- a/examples/TestExodusII.cpp
+++ b/examples/TestExodusII.cpp
@@ -1,9 +1,28 @@
 /** @example TestExodusII.cpp
- *  TestExodusII example demonstrates how to retrieve material, dirichlet and neumann sets from an Exodus file
- * Sets are traversed to find out the number of entities contained in each set.
- * The entities contained in each set are retrieved, using a Boolean flag to indicate that any contained sets
- * should be traversed recursively to include non-set entities in the results. */
-
+ * This example demonstrates how to retrieve material, dirichlet and neumann sets
+ * from an ExodusII file. \n
+ * Sets in MOAB contain entities and have a tag on them to give meaning to the entities.
+ * Tag names: MATERIAL_SET", "DIRICHLET_SET" and "NEUMANN_SET" are reserved and
+ * are associated with their corresponding entity sets.
+ * Sets are traversed to find out the type number of entities contained in each set. \n
+ *
+ * <b>Steps in this example </b>:
+ *    -# Instantiate MOAB
+ *    -# Get input mesh file name and load it.
+ *    -# Loop over the three sets: material, dirichlet and neumann
+ *      -# Get TagHandle and EntitySet(corresponding to the TagHandle)
+ *      -# Loop thru all the EntitySet's
+ *        -# Get the set id and entities in this set
+ *    -# Destroy the MOAB instance
+ *
+ *
+ * <b> To compile: </b>
+ *    make TestExodusII MOAB_DIR=<installdir> \n
+ *
+ * <b> To run: </b>
+ *    -# TestExodusII <mesh-file> \n
+ *    -# TestExodusII (This uses the default <mesh-file>: <MOAB_SRC_DIR>/MeshFiles/unittest/mbtest2.g)
+ */
 #include <iostream>
 
 // Include header for MOAB instance and range
@@ -15,7 +34,7 @@ int main(int argc, char **argv) {
   moab::Interface *mb = new moab::Core();
 
   // If no input is specified load ../MeshFiles/unittest/mbtest2.g
-  const char* test_file_name =  std::string("../MeshFiles/unittest/mbtest2.g");
+//  const char* test_file_name =  "../MeshFiles/unittest/mbtest2.g";
 
   // get the material set tag handle
   moab::Tag mtag;
@@ -25,11 +44,12 @@ int main(int argc, char **argv) {
 
   if (argc == 1) {
       std::cout << "Running default case, loading ../MeshFiles/unittest/mbtest2.g" << std::endl;
-      std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
+      std::cout << "Usage: " << argv[0] << " <filename>\n" << std::endl;
       rval = mb->load_file("../MeshFiles/unittest/mbtest2.g");
     }
   else{
       rval = mb->load_file(argv[argc-1]);
+      std::cout << "Loaded mesh file: " << argv[argc-1] << std::endl;
     }
 
   // loop over set types
@@ -59,15 +79,11 @@ int main(int argc, char **argv) {
 
           std::cout << tag_nms[i] << " " << set_id << " has "
                     << set_ents.size() << " entities:" << std::endl;
+
+          // print the entities contained in this set
           set_ents.print("   ");
           set_ents.clear();
         }
     }
-
-  // do the same for all sets
-  sets.clear();
-  rval = mb->get_entities_by_type(0, moab::MBENTITYSET, sets);
-  if (moab::MB_SUCCESS != rval) return 1;
-
   delete mb;
 }

diff --git a/examples/makefile b/examples/makefile
index e1b8ef0..dcf7029 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -17,6 +17,9 @@ ReduceExchangeTags : ReduceExchangeTags.o
 
 HelloMoabPar: HelloMoabPar.o
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} 
+
+TestExodusII: TestExodusII.o
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 	
 .cpp.o :
 	${MOAB_CXX} ${MOAB_CXXFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<


https://bitbucket.org/fathomteam/moab/commits/f7b9a7624a64/
Changeset:   f7b9a7624a64
Branch:      None
User:        iulian07
Date:        2013-04-16 19:21:27
Summary:     Merge branch 'master' of bitbucket.org:fathomteam/moab

Affected #:  2 files

diff --git a/examples/StructuredMeshSimple.cpp b/examples/StructuredMeshSimple.cpp
new file mode 100644
index 0000000..25aa08f
--- /dev/null
+++ b/examples/StructuredMeshSimple.cpp
@@ -0,0 +1,110 @@
+/** @example StructuredMeshSimple.cpp
+ * \brief Show creation and query of structured mesh, serial or parallel, through MOAB's structured mesh interface.
+ * This is an example showing creation and query of a 3D structured mesh.  In serial, a single N*N*N block of elements
+ * is created; in parallel, each proc gets an N*N*N block, with blocks arranged in a 1d column, sharing vertices
+ * and faces at their interfaces (proc 0 has no left neighbor and proc P-1 no right neighbor).
+ * Each square block of hex elements is then referenced by its ijk parameterization.
+ * 1D and 2D examples could be made simply by changing the dimension parameter passed into the MOAB functions. \n
+ *
+ * <b>This example </b>:
+ *    -# Instantiate MOAB and get the structured mesh interface
+ *    -# Decide what the local parameters of the mesh will be, based on parallel/serial and rank.
+ *    -# Create a N^d structured mesh, which includes (N+1)^d vertices and N^d elements.
+ *    -# Get the vertices and elements from moab and check their numbers against (N+1)^d and N^d, resp.
+ *    -# Loop over elements in d nested loops over i, j, k; for each (i,j,k):
+ *      -# Get the element corresponding to (i,j,k)
+ *      -# Get the connectivity of the element
+ *      -# Get the coordinates of the vertices comprising that element
+ *    -# Release the structured mesh interface and destroy the MOAB instance
+ *
+ * <b> To run: </b> ./structuredmesh [d [N] ] \n
+ * (default values so can run w/ no user interaction)
+ */
+
+#include "moab/Core.hpp"
+#include "moab/ScdInterface.hpp"
+#include "moab/ProgOptions.hpp"
+#include "moab/CN.hpp"
+#include <iostream>
+#include <vector>
+
+using namespace moab;
+
+int main(int argc, char **argv) 
+{
+  int N = 10, dim = 3;
+
+  ProgOptions opts;
+  opts.addOpt<int>(std::string("dim,d"), std::string("Dimension of mesh (default=3)"),
+                   &dim);
+  opts.addOpt<int>(std::string(",n"), std::string("Number of elements on a side (default=10)"),
+                   &N);
+  opts.parseCommandLine(argc, argv);
+  
+    // 0. Instantiate MOAB and get the structured mesh interface
+  Interface *mb = new Core();
+  ScdInterface *scdiface;
+  ErrorCode rval = mb->query_interface(scdiface); // get a ScdInterface object through moab instance
+  if (MB_SUCCESS != rval) return rval;
+
+    // 1. Decide what the local parameters of the mesh will be, based on parallel/serial and rank.
+  int ilow = 0, ihigh = N;
+  int rank = 0, nprocs = 1;
+#ifdef USE_MPI
+  MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  ilow = rank*N; ihigh = ilow + N;
+#endif  
+
+    // 2. Create a N^d structured mesh, which includes (N+1)^d vertices and N^d elements.
+  ScdBox *box;
+  rval = scdiface->construct_box(HomCoord(ilow, (dim>1?0:-1), (dim>2?0:-1)), // use in-line logical tests to handle dimensionality
+                                 HomCoord(ihigh, (dim>1?N:-1), (dim>2?N:-1)), 
+                                 NULL, 0, // NULL coords vector and 0 coords (don't specify coords for now)
+                                 box);    // box is the structured box object providing the parametric
+                                          // structured mesh interface for this rectangle of elements
+  if (MB_SUCCESS != rval) return rval;
+
+    // 3. Get the vertices and elements from moab and check their numbers against (N+1)^d and N^d, resp.
+  Range verts, elems;
+  rval = mb->get_entities_by_dimension(0, 0, verts); // first '0' specifies "root set", or entire MOAB instance, second the entity dimension being requested
+  if (MB_SUCCESS != rval) return rval;
+  rval = mb->get_entities_by_dimension(0, dim, elems);
+  if (MB_SUCCESS != rval) return rval;
+
+#define MYSTREAM(a) if (!rank) std::cout << a << std::endl
+  
+  if (pow(N,dim) == (int) elems.size() && pow(N+1,dim) == (int) verts.size()) { // expected #e and #v are N^d and (N+1)^d, resp.
+#ifdef USE_MPI
+    MYSTREAM("Proc 0: ");
+#endif
+    MYSTREAM("Created " << elems.size() << " " << CN::EntityTypeName(mb->type_from_handle(*elems.begin())) 
+             << " elements and " << verts.size() << " vertices." << std::endl);
+  }
+  else
+    std::cout << "Created the wrong number of vertices or hexes!" << std::endl;
+  
+    // 4. Loop over elements in 3 nested loops over i, j, k; for each (i,j,k):
+  std::vector<double> coords(3*pow(N+1,dim));
+  std::vector<EntityHandle> connect;
+  for (int k = 0; k < (dim>2?N:1); k++) {
+    for (int j = 0; j < (dim>1?N:1); j++) {
+      for (int i = 0; i < N-1; i++) {
+          // 4a. Get the element corresponding to (i,j,k)
+        EntityHandle ehandle = box->get_element(i, j, k);
+        if (0 == ehandle) return MB_FAILURE;
+          // 4b. Get the connectivity of the element
+        rval = mb->get_connectivity(&ehandle, 1, connect); // get the connectivity, in canonical order
+        if (MB_SUCCESS != rval) return rval;
+          // 4c. Get the coordinates of the vertices comprising that element
+        rval = mb->get_coords(connect.data(), connect.size(), coords.data()); // get the coordinates of those vertices
+        if (MB_SUCCESS != rval) return rval;
+      }
+    }
+  }
+
+    // 5. Release the structured mesh interface and destroy the MOAB instance
+  mb->release_interface(scdiface); // tell MOAB we're done with the ScdInterface
+  delete mb;
+  
+  return 0;
+}

diff --git a/examples/makefile b/examples/makefile
index dcf7029..4ec6154 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -20,7 +20,7 @@ HelloMoabPar: HelloMoabPar.o
 
 TestExodusII: TestExodusII.o
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
-	
+
 .cpp.o :
 	${MOAB_CXX} ${MOAB_CXXFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
 


https://bitbucket.org/fathomteam/moab/commits/ac920e4810b6/
Changeset:   ac920e4810b6
Branch:      master
User:        iulian07
Date:        2013-04-16 19:37:29
Summary:     doxygenize better; only one main page

Interface.hpp contains the main page for moab, hdf5 and itaps are "related" pages

Affected #:  3 files

diff --git a/itaps/iBase.h b/itaps/iBase.h
index 5172bb8..933b9d6 100644
--- a/itaps/iBase.h
+++ b/itaps/iBase.h
@@ -261,7 +261,7 @@ enum iBase_TagValueType {
  ******************************************************************************/
 
 /***************************************************************************//**
- * \mainpage The ITAPS Interfaces
+ * \page The ITAPS Interfaces
  *
  * \subpage ibase
  *
@@ -281,6 +281,8 @@ enum iBase_TagValueType {
  *
  * \subpage numhops
  *
+ * \subpage resilient
+ *
  * \page error Error Handling
  *
  * With few exceptions, every iMesh function includes an output argument,

diff --git a/itaps/imesh/iMeshP.h b/itaps/imesh/iMeshP.h
index 958c827..28da490 100644
--- a/itaps/imesh/iMeshP.h
+++ b/itaps/imesh/iMeshP.h
@@ -33,7 +33,7 @@ enum iMeshP_EntStatus
 #define iMeshP_ALL_PARTS -1
 
 
-/** \mainpage
+/** \page imeshp  iMeshP: ITAPS Parallel Mesh Interface
 iMeshP.h -- ITAPS Parallel Mesh Interface
 
 Release 0.1; October 2008
@@ -45,7 +45,7 @@ Release 0.1; October 2008
    subsets; like a "mesh," it does not imply a serial or parallel 
    implementation.
 -  An application may use one or more meshes.  
--  Parititions can create subsets of entities from one or more meshes.
+-  Partitions can create subsets of entities from one or more meshes.
 -  Meshes can be subdivided by one or more partitions.
 -  Partitions contain parts.  Parts contain the subsets of entities in the
    partition.

diff --git a/src/io/mhdf/include/mhdf.h b/src/io/mhdf/include/mhdf.h
index e8aaa90..9a7a478 100644
--- a/src/io/mhdf/include/mhdf.h
+++ b/src/io/mhdf/include/mhdf.h
@@ -22,7 +22,7 @@
 extern "C" {
 #endif
 
-/** \mainpage H5M File Format API 
+/** \page h5mmain H5M File Format API
  *
  *\section Intro   Introduction
  *
@@ -60,7 +60,7 @@ extern "C" {
  * hexahedral topology) and the number of nodes in the element.  
  *
  *
- *\section Root   The \c tstt Group
+ *\section Root   The tstt Group
  *
  * All file data is stored in the \c tstt group in the HDF5 root group.
  * The \c tstt group may have an optional scalar integer attribute 
@@ -87,12 +87,12 @@ extern "C" {
  * - \c Polyhedron
  * 
  *
- *\section History   The \c history DataSet
+ *\section History   The history DataSet
  *
  * The \c history DataSet is a list of variable-length strings with
- * appliation-defined meaning.  
+ * application-defined meaning.  
  *
- *\section Nodes   The \c nodes Group
+ *\section Nodes   The nodes Group
  *
  *
  * The \c nodes group contains a single DataSet and an optional
@@ -111,7 +111,7 @@ extern "C" {
  * \c coordinates table.
  *
  *
- *\section Elements   The \c elements Group 
+ *\section Elements   The elements Group
  *
  * The \c elements group contains an application-defined number of 
  * subgroups.  Each subgroup defines one or more mesh elements that
@@ -141,7 +141,7 @@ extern "C" {
  * sequentially in the order that they are defined in the table.
  *
  *
- *\section Sets   The \c sets Group
+ *\section Sets   The sets Group
  *
  * The \c sets group contains the definitions of any entity sets stored
  * in the file.  It contains 1 to 4 DataSets and the optional \c tags 
@@ -199,7 +199,7 @@ extern "C" {
  * subgroup is described in the \ref Dense "section on dense tag storage". 
  *
  * 
- * \section Tags   The \c tags Group
+ * \section Tags   The tags Group
  *
  * The \c tags group contains a sub-group for each tag defined
  * in the file.  These sub-groups contain the definition of the
@@ -283,7 +283,7 @@ extern "C" {
  * dataset.  
  *
  *
- * \section Dense   The \c tags Sub-Groups
+ * \section Dense   The tags Sub-Groups
  *
  * Data for fixed-length tags may also be stored in the \c tags sub-group
  * of the \c nodes, \c sets, and subgroups of the \c elements group.

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