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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu May 2 11:41:22 CDT 2013


2 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/732016ac34de/
Changeset:   732016ac34de
Branch:      None
User:        tautges
Date:        2013-05-02 18:10:38
Summary:     - Add configure magic for figuring out fortran runtime libs & adding them to the link libs
- Modify some comments in DirectAccessNoHoles, and fixed a bug with quad connectivity
- Added DirectAccessNoHolesF90 test, showing how to do this in F90
- Added Fortran equivalents of adjacency cost enums in iMesh
- Added MOAB make variables to moab.make for fortran options

Affected #:  7 files

diff --git a/config/compiler.m4 b/config/compiler.m4
index ce00d10..18df411 100644
--- a/config/compiler.m4
+++ b/config/compiler.m4
@@ -126,6 +126,8 @@ fi
 if test "xno" != "x$CHECK_FC"; then
   AC_PROG_FC
   AC_PROG_F77
+  AC_F77_LIBRARY_LDFLAGS
+  AC_FC_LIBRARY_LDFLAGS
 fi
 
 ]) # FATHOM_CHECK_COMPILERS

diff --git a/configure.ac b/configure.ac
index 66fcf81..1524b06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,14 @@ if test "xyes" = "x$ENABLE_FORTRAN" && test "x" != "x$FC"; then
   AC_FC_WRAPPERS
 fi
 
+if test "xyes" = "x$ENABLE_FORTRAN" && test "x" != "x$FLIBS"; then
+   LIBS="$LIBS $FLIBS"
+fi
+
+if test "xyes" = "x$ENABLE_FORTRAN" && test "x" != "x$FCLIBS"; then
+   LIBS="$LIBS $FCLIBS"
+fi
+
 ################################################################################
 #                           Check for need for extra flags to support cray pointers
 ################################################################################
@@ -1163,6 +1171,8 @@ AC_SUBST([EXPORT_LTFLAGS])
 AC_SUBST([EXPORT_LDFLAGS])
 AC_SUBST([AM_CXXFLAGS])
 AC_SUBST([AM_CFLAGS])
+  AC_SUBST([AM_FCFLAGS])
+  AC_SUBST([AM_FFLAGS])
 AC_SUBST([DISTCHECK_CONFIGURE_FLAGS])
 
 AC_ARG_VAR([FC], [FORTRAN compiler command])

diff --git a/examples/DirectAccessNoHoles.cpp b/examples/DirectAccessNoHoles.cpp
index 445c517..340efae 100644
--- a/examples/DirectAccessNoHoles.cpp
+++ b/examples/DirectAccessNoHoles.cpp
@@ -1,31 +1,30 @@
-/** @example DirectAccess.cpp \n
+/** @example DirectAccessNoHoles.cpp \n
  * \brief Use direct access to MOAB data to avoid calling through API \n
  *
- * This example creates a 1d row of quad elements, with a user-specified number of "holes" (missing quads) in the row:
+ * This example creates a 1d row of quad elements, such that all quad and vertex handles
+ * are contiguous in the handle space and in the database.  Then it shows how to get access
+ * to pointers to MOAB-native data for vertex coordinates, quad connectivity, tag storage,
+ * and vertex to quad adjacency lists.  This allows applications to access this data directly
+ * without going through MOAB's API.  In cases where the mesh is not changing (or only mesh
+ * vertices are moving), this can save significant execution time in applications.
  *
- *  ----------------------      ----------------------      --------
- *  |      |      |      |      |      |      |      |      |      |       
- *  |      |      |      |(hole)|      |      |      |(hole)|      | ...
- *  |      |      |      |      |      |      |      |      |      |
- *  ----------------------      ----------------------      --------
- *
- * This makes (nholes+1) contiguous runs of quad handles in the handle space
- * This example shows how to use the xxx_iterate functions in MOAB (xxx = coords, connect, tag, adjacencies) to get 
- * direct pointer access to MOAB internal storage, which can be used without calling through the MOAB API.
+ *  ----------------------
+ *  |      |      |      |       
+ *  |      |      |      | ...
+ *  |      |      |      |
+ *  ----------------------
  *
  *    -#  Initialize MOAB \n
- *    -#  Create a quad mesh with holes, as depicted above
+ *    -#  Create a quad mesh, as depicted above
  *    -#  Create 2 dense tags (tag1, tag2) for avg position to assign to quads, and # verts per quad (tag3)
  *    -#  Get connectivity, coordinate, tag1 iterators
  *    -#  Iterate through quads, computing midpoint based on vertex positions, set on quad-based tag1
- *    -#  Set up map from starting quad handle for a chunk to struct of (tag1_ptr, tag2_ptr, tag3_ptr), pointers to
- *        the dense tag storage for those tags for the chunk
  *    -#  Iterate through vertices, summing positions into tag2 on connected quads and incrementing vertex count
  *    -#  Iterate through quads, normalizing tag2 by vertex count and comparing values of tag1 and tag2
  *
  * <b>To compile</b>: \n
- *    make DirectAccessWithHoles MOAB_DIR=<installdir>  \n
- * <b>To run</b>: ./DirectAccess [-nquads <# quads>] [-holes <# holes>]\n
+ *    make DirectAccessNoHoles MOAB_DIR=<installdir>  \n
+ * <b>To run</b>: ./DirectAccessNoHoles [-nquads <# quads>]\n
  *
  */
 
@@ -131,12 +130,16 @@ int main(int argc, char **argv)
         
     // Normalize tag2 by vertex count (tag3); loop over elements using same approach as before
     // At the same time, compare values of tag1 and tag2
+  int n_dis = 0;
   for (Range::iterator q_it = quads.begin(); q_it != quads.end(); q_it++) {
     int i = *q_it - start_quad;
     for (int j = 0; j < 3; j++) tag2_ptr[3*i+j] /= (double)tag3_ptr[i];  // normalize by # verts
-    if (tag1_ptr[3*i] != tag2_ptr[3*i] || tag1_ptr[3*i+1] != tag2_ptr[3*i+1] || tag1_ptr[3*i+2] != tag2_ptr[3*i+2]) 
+    if (tag1_ptr[3*i] != tag2_ptr[3*i] || tag1_ptr[3*i+1] != tag2_ptr[3*i+1] || tag1_ptr[3*i+2] != tag2_ptr[3*i+2]) {
       std::cout << "Tag1, tag2 disagree for element " << *q_it + i << std::endl;
+      n_dis++;
+    }
   }
+  if (!n_dis) std::cout << "All tags agree, success!" << std::endl;
 
     // Ok, we're done, shut down MOAB
   delete mbImpl;
@@ -151,7 +154,7 @@ ErrorCode create_mesh_no_holes(Interface *mbImpl, int nquads)
   ErrorCode rval = mbImpl->query_interface(read_iface); CHKERR(rval, "query_interface");
   std::vector<double *> coords;
   EntityHandle start_vert, start_elem, *connect;
-    // create verts, num is 4(nquads+1) because they're in a 1d row; will initialize coords in loop over quads later
+    // create verts, num is 2(nquads+1) because they're in a 1d row; will initialize coords in loop over quads later
   rval = read_iface->get_node_coords (3, 2*(nquads+1), 0, start_vert, coords); CHKERR(rval, "get_node_arrays");
     // create quads
   rval = read_iface->get_element_connect(nquads, 4, MBQUAD, 0, start_elem, connect); CHKERR(rval, "get_element_connect");
@@ -160,8 +163,12 @@ ErrorCode create_mesh_no_holes(Interface *mbImpl, int nquads)
     coords[1][2*i] = 0.0; coords[1][2*i+1] = 1.0; // y coords
     coords[2][2*i] = coords[2][2*i+1] = (double) 0.0; // z values, all zero (2d mesh)
     EntityHandle quad_v = start_vert + 2*i;
-    for (int j = 0; j < 4; j++) connect[4*i+j] = quad_v+j; // connectivity of each quad is a sequence starting from quad_v
+    connect[4*i+0] = quad_v;
+    connect[4*i+1] = quad_v+2;
+    connect[4*i+2] = quad_v+3;
+    connect[4*i+3] = quad_v+1;
   }
+  
     // last two vertices
   coords[0][2*nquads] = coords[0][2*nquads+1] = (double) nquads;
   coords[1][2*nquads] = 0.0; coords[1][2*nquads+1] = 1.0; // y coords

diff --git a/examples/DirectAccessNoHolesF90 b/examples/DirectAccessNoHolesF90
new file mode 100755
index 0000000..1f44b63
Binary files /dev/null and b/examples/DirectAccessNoHolesF90 differ

diff --git a/examples/makefile b/examples/makefile
index fd6585e..3402f96 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -1,7 +1,8 @@
 # MOAB_DIR points to top-level install dir, below which MOAB's lib/ and include/ are located
 include ${MOAB_DIR}/lib/moab.make
+include ${MOAB_DIR}/lib/iMesh-Defs.inc
 
-.SUFFIXES: .o .cpp
+.SUFFIXES: .o .cpp .F90
 
 # MESH_DIR is the top-level MOAB source directory, used to locate mesh files that come with MOAB source
 MESH_DIR="../MeshFiles/unittest"
@@ -27,6 +28,12 @@ DirectAccessWithHoles: DirectAccessWithHoles.o
 DirectAccessNoHoles: DirectAccessNoHoles.o
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
+DirectAccessNoHolesF90: DirectAccessNoHolesF90.o
+	${MOAB_CXX} -o $@ $< ${IMESH_LIBS}
+
 .cpp.o :
 	${MOAB_CXX} ${MOAB_CXXFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
 
+.F90.o :
+	${IMESH_FC} ${IMESH_FCFLAGS} ${IMESH_INCLUDES} ${IMESH_FCDEFS} -DMESH_DIR=\"${MESH_DIR}\" -c $<
+

diff --git a/itaps/iBase_f.h.in b/itaps/iBase_f.h.in
index 4a70fd3..90fde77 100644
--- a/itaps/iBase_f.h.in
+++ b/itaps/iBase_f.h.in
@@ -50,7 +50,27 @@
       parameter (iBase_REGION = 3)
       parameter (iBase_ALL_TYPES = 4)
 
-
+      integer iBase_AdjacencyCost_MIN
+      integer iBase_UNAVAILABLE
+      integer iBase_ALL_ORDER_1
+      integer iBase_ALL_ORDER_LOGN
+      integer iBase_ALL_ORDER_N
+      integer iBase_SOME_ORDER_1
+      integer iBase_SOME_ORDER_LOGN
+      integer iBase_SOME_ORDER_N
+      integer iBase_AVAILABLE
+      integer iBase_AdjacencyCost_MAX
+
+      parameter (iBase_AdjacencyCost_MIN = 0)
+      parameter (iBase_UNAVAILABLE = 0)
+      parameter (iBase_ALL_ORDER_1 = 1)
+      parameter (iBase_ALL_ORDER_LOGN = 2)
+      parameter (iBase_ALL_ORDER_N = 3)
+      parameter (iBase_SOME_ORDER_1 = 4)
+      parameter (iBase_SOME_ORDER_LOGN = 5)
+      parameter (iBase_SOME_ORDER_N = 6)
+      parameter (iBase_AVAILABLE = 7)
+      parameter (iBase_AdjacencyCost_MAX = 7)
 
       integer iBase_NEW
       integer iBase_ALREADY_EXISTED

diff --git a/moab.make.in b/moab.make.in
index 1e294b3..e6dc42d 100644
--- a/moab.make.in
+++ b/moab.make.in
@@ -10,12 +10,16 @@ MOAB_INCLUDES = -I at abs_srcdir@/src \
 
 MOAB_CXXFLAGS = @CXXFLAGS@ @AM_CXXFLAGS@
 MOAB_CFLAGS = @CFLAGS@ @AM_CFLAGS@
+MOAB_FFLAGS = @FFLAGS@
+MOAB_FCFLAGS = @FCFLAGS@
 MOAB_LDFLAGS = @EXPORT_LDFLAGS@
 
 MOAB_LIBS_LINK = ${MOAB_LDFLAGS} -L${MOAB_LIBDIR} -lMOAB @LIBS@ @PNETCDF_LIBS@ @NETCDF_LIBS@ @HDF5_LIBS@ @CCMIO_LIBS@ @CGM_LIBS@
 
 MOAB_CXX = @CXX@
 MOAB_CC  = @CC@
+MOAB_FC  = @FC@
+MOAB_F77  = @F77@
 
 # Override MOAB_LIBDIR and MOAB_INCLUDES from above with the correct
 # values for the installed MOAB.


https://bitbucket.org/fathomteam/moab/commits/69eede5dbcc1/
Changeset:   69eede5dbcc1
Branch:      master
User:        tautges
Date:        2013-05-02 18:38:12
Summary:     Merge branch 'master' of bitbucket.org:fathomteam/moab

Affected #:  2 files

diff --git a/src/io/ReadNC.cpp b/src/io/ReadNC.cpp
index d7bcb35..774f7a6 100644
--- a/src/io/ReadNC.cpp
+++ b/src/io/ReadNC.cpp
@@ -2321,6 +2321,10 @@ ErrorCode ReadNC::init_FVCDscd_vals(const FileOptions &opts, EntityHandle file_s
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
   }
 
+  // hack: create dummy tags, if needed, for dimensions like nbnd
+  // with no corresponding variables
+  init_dims_with_no_cvars_info();
+
   return MB_SUCCESS;
 }
 
@@ -2699,9 +2703,39 @@ ErrorCode ReadNC::init_EulSpcscd_vals(const FileOptions &opts, EntityHandle file
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
   }
 
+  // hack: create dummy tags, if needed, for variables like nbnd
+  // with no corresponding variables
+  init_dims_with_no_cvars_info();
+
   return MB_SUCCESS;
 }
 
+void ReadNC::init_dims_with_no_cvars_info() {
+  // hack: look at all dimensions, and see if we have one that does not appear in the list of varInfo names
+  // right now, candidates are ncol and nbnd
+  // for them, create dummy tags
+  for (unsigned int i=0; i<dimNames.size(); i++)
+  {
+    // if there is a var with this name, skip, we are fine; if not, create a varInfo...
+    if ( varInfo.find(dimNames[i])!=varInfo.end())
+      continue; // we already have a variable with this dimension name
+
+    int sizeTotalVar = varInfo.size();
+    std::string var_name(dimNames[i]);
+    VarData &data = varInfo[var_name];
+    data.varName = std::string(var_name);
+    data.varId =sizeTotalVar;
+    data.varTags.resize(1, 0);
+    data.varDataType = NC_DOUBLE; // could be int, actually, but we do not really need the type
+    data.varDims.resize(1);
+    data.varDims[0]= (int)i;
+    data.numAtts=0;
+    data.entLoc = ENTLOCSET;
+    dbgOut.tprintf(2, "Dummy varInfo created for dimension %s\n", dimNames[i].c_str());
+    dummyVarNames.insert(dimNames[i]);
+  }
+}
+
 ErrorCode ReadNC::init_HOMMEucd_vals() {
   ErrorCode rval;
   unsigned int idx;
@@ -2812,29 +2846,10 @@ ErrorCode ReadNC::init_HOMMEucd_vals() {
 
   // don't read coordinates of columns until we actually create the mesh
 
-  // hack: look at all dimensions, and see if we have one that does not appear in the list of varInfo names
-  // right now, candidates are ncol and nbnd
-  // for them, create dummy tags
-  for (unsigned int i=0; i<dimNames.size(); i++)
-  {
-    // if there is a var with this name, skip, we are fine; if not, create a varInfo...
-    if ( varInfo.find(dimNames[i])!=varInfo.end())
-      continue; // we already have a variable with this dimension name
+  // hack: create dummy tags, if needed, for variables like ncol and nbnd
+  // with no corresponding variables
+  init_dims_with_no_cvars_info();
 
-    int sizeTotalVar = varInfo.size();
-    std::string var_name(dimNames[i]);
-    VarData &data = varInfo[var_name];
-    data.varName = std::string(var_name);
-    data.varId =sizeTotalVar;
-    data.varTags.resize(1, 0);
-    data.varDataType = NC_DOUBLE; // could be int, actually, but we do not really need the type
-    data.varDims.resize(1);
-    data.varDims[0]= (int)i;
-    data.numAtts=0;
-    data.entLoc = ENTLOCSET;
-    dbgOut.tprintf(2, "Dummy varInfo created for dimension %s\n", dimNames[i].c_str());
-    dummyVarNames.insert(dimNames[i]);
-  }
   return MB_SUCCESS;
 }
 

diff --git a/src/io/ReadNC.hpp b/src/io/ReadNC.hpp
index d5a18eb..7bc07d5 100644
--- a/src/io/ReadNC.hpp
+++ b/src/io/ReadNC.hpp
@@ -236,6 +236,10 @@ private:
   //! create COORDS tag for quads coordinate
   ErrorCode create_quad_coordinate_tag(EntityHandle file_set);
 
+  //! Init info for dimensions that don't have corresponding 
+  //! coordinate variables - this info is used for creating tags
+  void init_dims_with_no_cvars_info();
+
   ErrorCode init_HOMMEucd_vals();
 
   ErrorCode create_ucd_verts_quads(const FileOptions &opts, EntityHandle tmp_set, Range &quads);

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