[MOAB-dev] r3039 - in MOAB/trunk: . tools/iMesh

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Tue Jul 21 15:22:28 CDT 2009


Author: kraftche
Date: 2009-07-21 15:22:28 -0500 (Tue, 21 Jul 2009)
New Revision: 3039

Added:
   MOAB/trunk/MBCN.h
   MOAB/trunk/tools/iMesh/mkprotos.sh
Removed:
   MOAB/trunk/MBCN_protos.h
Modified:
   MOAB/trunk/MBCN.hpp
   MOAB/trunk/Makefile.am
   MOAB/trunk/tools/iMesh/Makefile.am
Log:
o Move MBCN C API to a separate header
o Move logic for generating fortran protos to separate script
o Generate MBCN_protos.h automatically


Added: MOAB/trunk/MBCN.h
===================================================================
--- MOAB/trunk/MBCN.h	                        (rev 0)
+++ MOAB/trunk/MBCN.h	2009-07-21 20:22:28 UTC (rev 3039)
@@ -0,0 +1,153 @@
+
+#include "MBEntityType.h"
+#include "MBCN_protos.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif    
+
+    void MBCN_GetBasis(int *rval);
+  
+    void MBCN_SetBasis(const int in_basis);
+
+    void MBCN_EntityTypeName(const int this_type, char *rval, int rval_len);
+  
+    void MBCN_EntityTypeFromName(const char *name, int *rval);
+  
+    void MBCN_Dimension(const int t, int *rval);
+
+    void MBCN_VerticesPerEntity(const int t, int *rval);
+  
+    void MBCN_NumSubEntities(const int t, const int d, int *rval);
+
+    void MBCN_SubEntityType(const int this_type,
+                            const int sub_dimension,
+                            const int index, int *rval);
+  
+    void MBCN_SubEntityVertexIndices(const int this_type, 
+                                     const int sub_dimension,
+                                     const int sub_index,
+                                     int sub_entity_conn[]);
+
+    void MBCN_AdjacentSubEntities(const int this_type,
+                                  const int *source_indices,
+                                  const int num_source_indices,
+                                  const int source_dim,
+                                  const int target_dim,
+                                  int *index_list,
+                                  int *num_indices,
+                                  const int operation_type, int *rval);
+
+    void MBCN_SideNumberInt(const int *parent_conn, const MBEntityType parent_type,
+                            const int *child_conn, const int child_num_verts,
+                            const int child_dim,
+                            int *side_no, int *sense, int *offset);
+
+    void MBCN_SideNumberUint(const unsigned int *parent_conn, const MBEntityType parent_type,
+                             const unsigned int *child_conn, const int child_num_verts,
+                             const int child_dim,
+                             int *side_no, int *sense, int *offset);
+
+    void MBCN_SideNumberLong(const long *parent_conn, const MBEntityType parent_type,
+                             const long *child_conn, const int child_num_verts,
+                             const int child_dim,
+                             int *side_no, int *sense, int *offset);
+
+    void MBCN_SideNumberUlong(const unsigned long *parent_conn, const MBEntityType parent_type,
+                              const unsigned long *child_conn, const int child_num_verts,
+                              const int child_dim,
+                              int *side_no, int *sense, int *offset);
+
+    void MBCN_SideNumberVoid(void * const *parent_conn, const MBEntityType parent_type,
+                             void * const *child_conn, const int child_num_verts,
+                             const int child_dim,
+                             int *side_no, int *sense, int *offset);
+
+    void MBCN_SideNumber(const int parent_type,
+                         const int *child_conn_indices, const int child_num_verts,
+                         const int child_dim,
+                         int *side_no, int *sense, int *offset);
+
+    void MBCN_OppositeSide(const int parent_type,
+                           const int child_index,
+                           const int child_dim,
+                           int *opposite_index,
+                           int *opposite_dim, int *rval);
+
+    void MBCN_ConnectivityMatchInt(const int *conn1,
+                                   const int *conn2,
+                                   const int num_vertices,
+                                   int *direct, int *offset, int *rval);
+    void MBCN_ConnectivityMatchUint(const unsigned int *conn1,
+                                    const unsigned int *conn2,
+                                    const int num_vertices,
+                                    int *direct, int *offset, 
+                                    int *rval);
+    void MBCN_ConnectivityMatchLong(const long* conn1,
+                                    const long* conn2,
+                                    const int num_vertices,
+                                    int* direct, int* offset , int *rval);
+    void MBCN_ConnectivityMatchUlong(const unsigned long* conn1,
+                                     const unsigned long* conn2,
+                                     const int num_vertices,
+                                     int *direct, int* offset,
+                                     int *rval);
+    void MBCN_ConnectivityMatchVoid(void* const* conn1,
+                                    void* const* conn2,
+                                    const int num_vertices,
+                                    int* direct, int* offset , int *rval);
+
+    void MBCN_setPermutation(const MBEntityType t, const int dim, int *pvec, 
+                             const int num_entries, const int is_reverse);
+  
+    void MBCN_resetPermutation(const MBEntityType t, const int dim);
+
+    void MBCN_permuteThisInt(const MBEntityType t, const int dim, int *pvec, 
+                             const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_permuteThisUint(const MBEntityType t, const int dim, unsigned int *pvec, 
+                              const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_permuteThisLong(const MBEntityType t, const int dim, long *pvec, 
+                              const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_permuteThisVoid(const MBEntityType t, const int dim, void **pvec, 
+                              const int num_indices, const int num_entries, int *rval);
+  
+    void MBCN_revPermuteThisInt(const MBEntityType t, const int dim, int *pvec, 
+                             const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_revPermuteThisUint(const MBEntityType t, const int dim, unsigned int *pvec, 
+                              const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_revPermuteThisLong(const MBEntityType t, const int dim, long *pvec, 
+                              const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_revPermuteThisVoid(const MBEntityType t, const int dim, void **pvec, 
+                              const int num_indices, const int num_entries, int *rval);
+
+    void MBCN_HasMidEdgeNodes(const int this_type, 
+                              const int num_verts, int *rval);
+
+    void MBCN_HasMidFaceNodes(const int this_type, 
+                              const int num_verts, int *rval);
+
+    void MBCN_HasMidRegionNodes(const int this_type, 
+                                const int num_verts, int *rval);
+
+    void MBCN_HasMidNodes(const int this_type, 
+                          const int num_verts, 
+                          int mid_nodes[4]);
+
+    void MBCN_HONodeParent( int elem_type,
+                            int num_nodes, 
+                            int ho_node_index,
+                            int *parent_dim, 
+                            int *parent_index );
+
+    void MBCN_HONodeIndex(const int this_type, const int num_verts,
+                          const int subfacet_dim, const int subfacet_index, int *rval);
+
+#ifdef __cplusplus
+}
+#endif

Modified: MOAB/trunk/MBCN.hpp
===================================================================
--- MOAB/trunk/MBCN.hpp	2009-07-21 19:41:43 UTC (rev 3038)
+++ MOAB/trunk/MBCN.hpp	2009-07-21 20:22:28 UTC (rev 3039)
@@ -32,10 +32,6 @@
 #ifndef MBCN_HPP
 #define MBCN_HPP
 
-#include "MBCN_protos.h"
-
-#ifdef __cplusplus
-
 #include <vector>
 #include <algorithm>
 #include <cassert>
@@ -585,157 +581,4 @@
     permuteVec[t][dim][MB_MAX_SUB_ENTITIES] = MB_MAX_SUB_ENTITIES+1;
 }
 
-
 #endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif    
-
-    void MBCN_GetBasis(int *rval);
-  
-    void MBCN_SetBasis(const int in_basis);
-
-    void MBCN_EntityTypeName(const int this_type, char *rval, int rval_len);
-  
-    void MBCN_EntityTypeFromName(const char *name, int *rval);
-  
-    void MBCN_Dimension(const int t, int *rval);
-
-    void MBCN_VerticesPerEntity(const int t, int *rval);
-  
-    void MBCN_NumSubEntities(const int t, const int d, int *rval);
-
-    void MBCN_SubEntityType(const int this_type,
-                            const int sub_dimension,
-                            const int index, int *rval);
-  
-    void SubEntityVertexIndices(const int this_type, 
-                                const int sub_dimension,
-                                const int sub_index,
-                                int sub_entity_conn[]);
-
-    void MBCN_AdjacentSubEntities(const int this_type,
-                                  const int *source_indices,
-                                  const int num_source_indices,
-                                  const int source_dim,
-                                  const int target_dim,
-                                  int *index_list,
-                                  int *num_indices,
-                                  const int operation_type, int *rval);
-
-    void MBCN_SideNumberInt(const int *parent_conn, const MBEntityType parent_type,
-                            const int *child_conn, const int child_num_verts,
-                            const int child_dim,
-                            int *side_no, int *sense, int *offset);
-
-    void MBCN_SideNumberUint(const unsigned int *parent_conn, const MBEntityType parent_type,
-                             const unsigned int *child_conn, const int child_num_verts,
-                             const int child_dim,
-                             int *side_no, int *sense, int *offset);
-
-    void MBCN_SideNumberLong(const long *parent_conn, const MBEntityType parent_type,
-                             const long *child_conn, const int child_num_verts,
-                             const int child_dim,
-                             int *side_no, int *sense, int *offset);
-
-    void MBCN_SideNumberUlong(const unsigned long *parent_conn, const MBEntityType parent_type,
-                              const unsigned long *child_conn, const int child_num_verts,
-                              const int child_dim,
-                              int *side_no, int *sense, int *offset);
-
-    void MBCN_SideNumberVoid(void * const *parent_conn, const MBEntityType parent_type,
-                             void * const *child_conn, const int child_num_verts,
-                             const int child_dim,
-                             int *side_no, int *sense, int *offset);
-
-    void MBCN_SideNumber(const int parent_type,
-                         const int *child_conn_indices, const int child_num_verts,
-                         const int child_dim,
-                         int *side_no, int *sense, int *offset);
-
-    void MBCN_OppositeSide(const int parent_type,
-                           const int child_index,
-                           const int child_dim,
-                           int *opposite_index,
-                           int *opposite_dim, int *rval);
-
-    void MBCN_ConnectivityMatchInt(const int *conn1,
-                                   const int *conn2,
-                                   const int num_vertices,
-                                   int *direct, int *offset, int *rval);
-    void MBCN_ConnectivityMatchUint(const unsigned int *conn1,
-                                    const unsigned int *conn2,
-                                    const int num_vertices,
-                                    int *direct, int *offset, 
-                                    int *rval);
-    void MBCN_ConnectivityMatchLong(const long* conn1,
-                                    const long* conn2,
-                                    const int num_vertices,
-                                    int* direct, int* offset , int *rval);
-    void MBCN_ConnectivityMatchUlong(const unsigned long* conn1,
-                                     const unsigned long* conn2,
-                                     const int num_vertices,
-                                     int *direct, int* offset,
-                                     int *rval);
-    void MBCN_ConnectivityMatchVoid(void* const* conn1,
-                                    void* const* conn2,
-                                    const int num_vertices,
-                                    int* direct, int* offset , int *rval);
-
-    void MBCN_setPermutation(const MBEntityType t, const int dim, int *pvec, 
-                             const int num_entries, const int is_reverse);
-  
-    void MBCN_resetPermutation(const MBEntityType t, const int dim);
-
-    void MBCN_permuteThisInt(const MBEntityType t, const int dim, int *pvec, 
-                             const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_permuteThisUint(const MBEntityType t, const int dim, unsigned int *pvec, 
-                              const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_permuteThisLong(const MBEntityType t, const int dim, long *pvec, 
-                              const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_permuteThisVoid(const MBEntityType t, const int dim, void **pvec, 
-                              const int num_indices, const int num_entries, int *rval);
-  
-    void MBCN_revPermuteThisInt(const MBEntityType t, const int dim, int *pvec, 
-                             const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_revPermuteThisUint(const MBEntityType t, const int dim, unsigned int *pvec, 
-                              const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_revPermuteThisLong(const MBEntityType t, const int dim, long *pvec, 
-                              const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_revPermuteThisVoid(const MBEntityType t, const int dim, void **pvec, 
-                              const int num_indices, const int num_entries, int *rval);
-
-    void MBCN_HasMidEdgeNodes(const int this_type, 
-                              const int num_verts, int *rval);
-
-    void MBCN_HasMidFaceNodes(const int this_type, 
-                              const int num_verts, int *rval);
-
-    void MBCN_HasMidRegionNodes(const int this_type, 
-                                const int num_verts, int *rval);
-
-    void MBCN_HasMidNodes(const int this_type, 
-                          const int num_verts, 
-                          int mid_nodes[4]);
-
-    void MBCN_HONodeParent( int elem_type,
-                            int num_nodes, 
-                            int ho_node_index,
-                            int *parent_dim, 
-                            int *parent_index );
-
-    void MBCN_HONodeIndex(const int this_type, const int num_verts,
-                          const int subfacet_dim, const int subfacet_index, int *rval);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif

Deleted: MOAB/trunk/MBCN_protos.h
===================================================================
--- MOAB/trunk/MBCN_protos.h	2009-07-21 19:41:43 UTC (rev 3038)
+++ MOAB/trunk/MBCN_protos.h	2009-07-21 20:22:28 UTC (rev 3039)
@@ -1,33 +0,0 @@
-#include "MBCN_FCDefs.h"
-#ifdef FC_FUNC_
-
-  /* get the basis of the numbering system */
-#define MBCN_GetBasis FC_FUNC_(mbcn_getbasis, MBCN_GETBASIS)
-#define MBCN_SetBasis FC_FUNC_(mbcn_setbasis, MBCN_SETBASIS)
-#define MBCN_EntityTypeName FC_FUNC_(mbcn_entitytypename, MBCN_ENTITYTYPENAME)
-#define MBCN_EntityTypeFromName FC_FUNC_(mbcn_entitytypefromname, MBCN_ENTITYTYPEFROMNAME)
-#define MBCN_Dimension FC_FUNC_(mbcn_dimension, MBCN_DIMENSION)
-#define MBCN_VerticesPerEntity FC_FUNC_(mbcn_verticesperentity, MBCN_VERTICESPERENTITY)
-#define MBCN_NumSubEntities FC_FUNC_(mbcn_numsubentities, MBCN_NUMSUBENTITIES)
-#define MBCN_SubEntityType FC_FUNC_(mbcn_subentitytype, MBCN_SUBENTITYTYPE)
-#define MBCN_AdjacentSubEntities FC_FUNC_(mbcn_adjacentsubentities, MBCN_ADJACENTSUBENTITIES)
-#define MBCN_SideNumber FC_FUNC_(mbcn_sidenumber, MBCN_SIDENUMBER)
-#define MBCN_SideNumberInt FC_FUNC_(mbcn_sidenumberint, MBCN_SIDENUMBERINT)
-#define MBCN_SideNumberUint FC_FUNC_(mbcn_sidenumberuint, MBCN_SIDENUMBERUINT)
-#define MBCN_SideNumberLong FC_FUNC_(mbcn_sidenumberlong, MBCN_SIDENUMBERLONG)
-#define MBCN_SideNumberUlong FC_FUNC_(mbcn_sidenumberulong, MBCN_SIDENUMBERULONG)
-#define MBCN_SideNumberVoid FC_FUNC_(mbcn_sidenumbervoid, MBCN_SIDENUMBERVOID)
-#define MBCN_OppositeSide FC_FUNC_(mbcn_oppositeside, MBCN_OPPOSITESIDE)
-#define MBCN_ConnectivityMatchInt FC_FUNC_(mbcn_connectivitymatchint, MBCN_CONNECTIVITYMATCHINT)
-#define MBCN_ConnectivityMatchUint FC_FUNC_(mbcn_connectivitymatchuint, MBCN_CONNECTIVITYMATCHUINT)
-#define MBCN_ConnectivityMatchLong FC_FUNC_(mbcn_connectivitymatchlong, MBCN_CONNECTIVITYMATCHLONG)
-#define MBCN_ConnectivityMatchUlong FC_FUNC_(mbcn_connectivitymatchulong, MBCN_CONNECTIVITYMATCHULONG)
-#define MBCN_ConnectivityMatchVoid FC_FUNC_(mbcn_connectivitymatchvoid, MBCN_CONNECTIVITYMATCHVOID)
-#define MBCN_HasMidEdgeNodes FC_FUNC_(mbcn_hasmidedgenodes, MBCN_HASMIDEDGENODES)
-#define MBCN_HasMidFaceNodes FC_FUNC_(mbcn_hasmidfacenodes, MBCN_HASMIDFACENODES)
-#define MBCN_HasMidRegionNodes FC_FUNC_(mbcn_hasmidregionnodes, MBCN_HASMIDREGIONNODES)
-#define MBCN_HasMidNodes FC_FUNC_(mbcn_hasmidnodes, MBCN_HASMIDNODES)
-#define MBCN_HONodeParent FC_FUNC_(mbcn_honodeparent, MBCN_HONODEPARENT)
-#define MBCN_HONodeIndex FC_FUNC_(mbcn_honodeindex, MBCN_HONODEINDEX)
-
-#endif

Modified: MOAB/trunk/Makefile.am
===================================================================
--- MOAB/trunk/Makefile.am	2009-07-21 19:41:43 UTC (rev 3038)
+++ MOAB/trunk/Makefile.am	2009-07-21 20:22:28 UTC (rev 3039)
@@ -15,6 +15,7 @@
 endif
 SUBDIRS += . test tools doc doxygen 
 
+BUILT_SOURCES = MBCN_protos.h
 
 # Things to build
 lib_LTLIBRARIES = libMOAB.la 
@@ -239,6 +240,7 @@
   MBAdaptiveKDTree.hpp \
   MBBSPTree.hpp \
   MBCN.hpp \
+  MBCN.h \
   MBCN_FCDefs.h \
   MBCN_protos.h \
   MBCartVect.hpp \
@@ -268,6 +270,9 @@
   WriteTemplate.hpp \
   $(MOAB_EXTRA_HDRS)
 
+MBCN_protos.h: MBCN.h
+	$(srcdir)/tools/iMesh/mkprotos.sh MBCN $< $@ MBCN_FCDefs.h
+
 CPPFLAGS += -DSRCDIR=$(srcdir)
 
 # Tests and such

Modified: MOAB/trunk/tools/iMesh/Makefile.am
===================================================================
--- MOAB/trunk/tools/iMesh/Makefile.am	2009-07-21 19:41:43 UTC (rev 3038)
+++ MOAB/trunk/tools/iMesh/Makefile.am	2009-07-21 20:22:28 UTC (rev 3039)
@@ -83,43 +83,11 @@
 	echo "IMESH_LIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/iMesh-Defs.inc
 	echo "MOAB_LIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/iMesh-Defs.inc
 
-
-FPFX=iMesh
-SEDEXPR = 's/^[[:space:]]*void[[:space:]][[:space:]]*$(FPFX)_\([a-z][_a-zA-Z0-9]*\)[[:space:]]*(.*$$/$(FPFX)_\1/p'
 iMesh_protos.h: iMesh.h
-	echo '#include "MBCN_FCDefs.h"' > $@
-	echo '#ifdef FC_FUNC_' >> $@
-	echo >> $@
-	for func in `$(SED) -n $(SEDEXPR) $<`; do \
-	  lower=`echo $$func | tr '[:upper:]' '[:lower:]'`; \
-          upper=`echo $$func | tr '[:lower:]' '[:upper:]'`; \
-	  echo "#define $$func FC_FUNC_( $$lower, $$upper )" >> $@; \
-        done
-	echo >> $@
-	echo "#endif" >> $@
+	$(srcdir)/mkprotos.sh iMesh $< $@
 
 iMesh_extensions_protos.h: iMesh_extensions.h
-	echo '#include "MBCN_FCDefs.h"' > $@
-	echo '#ifdef FC_FUNC_' >> $@
-	echo >> $@
-	for func in `$(SED) -n $(SEDEXPR) $<`; do \
-	  lower=`echo $$func | tr '[:upper:]' '[:lower:]'`; \
-          upper=`echo $$func | tr '[:lower:]' '[:upper:]'`; \
-	  echo "#define $$func FC_FUNC_( $$lower, $$upper )" >> $@; \
-        done
-	echo >> $@
-	echo "#endif" >> $@
+	$(srcdir)/mkprotos.sh iMesh $< $@
 
-PFPFX=iMeshP
-PSEDEXPR = 's/^[[:space:]]*void[[:space:]][[:space:]]*$(PFPFX)_\([a-z][_a-zA-Z0-9]*\)[[:space:]]*(.*$$/$(PFPFX)_\1/p'
 iMeshP_protos.h: iMeshP.h
-	echo '#include "MBCN_FCDefs.h"' > $@
-	echo '#ifdef FC_FUNC_' >> $@
-	echo >> $@
-	for func in `$(SED) -n $(PSEDEXPR) $<`; do \
-	  lower=`echo $$func | tr '[:upper:]' '[:lower:]'`; \
-          upper=`echo $$func | tr '[:lower:]' '[:upper:]'`; \
-	  echo "#define $$func FC_FUNC_( $$lower, $$upper )" >> $@; \
-        done
-	echo >> $@
-	echo "#endif" >> $@
+	$(srcdir)/mkprotos.sh iMeshP $< $@

Added: MOAB/trunk/tools/iMesh/mkprotos.sh
===================================================================
--- MOAB/trunk/tools/iMesh/mkprotos.sh	                        (rev 0)
+++ MOAB/trunk/tools/iMesh/mkprotos.sh	2009-07-21 20:22:28 UTC (rev 3039)
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+default_fcdefs=iBase_FCDefs.h
+case "x$1" in
+  x|x-*)
+    echo "Usage: $0 <PREFIX> <INPUT_FILE> <OUTPUT_FILE> [<FCDEFS>=${default_fcdefs}]"
+    ;;
+esac
+
+PFX="$1"
+INPUT="$2"
+OUTPUT="$3"
+if test "x" != "x$4"; then
+  FCDEFS="$4"
+else
+  FCDEFS="$default_fcdefs"
+fi
+
+if test "x" = "x$SED"; then
+  SED=`which sed`
+fi
+
+EXPR="s/^[[:space:]]*void[[:space:]][[:space:]]*${PFX}_\([_a-zA-Z0-9][_a-zA-Z0-9]*\)[[:space:]]*(.*\$/${PFX}_\1/p"
+
+echo "#include \"$FCDEFS\"" > $OUTPUT
+echo '#ifdef FC_FUNC_' >> $OUTPUT
+echo >> $OUTPUT
+for func in `$SED -n "$EXPR" $INPUT`; do
+  lower=`echo $func | tr '[:upper:]' '[:lower:]'`
+  upper=`echo $func | tr '[:lower:]' '[:upper:]'`
+  echo "#define $func FC_FUNC_( $lower, $upper )" >> $OUTPUT
+done
+echo >> $OUTPUT
+echo "#endif" >> $OUTPUT


Property changes on: MOAB/trunk/tools/iMesh/mkprotos.sh
___________________________________________________________________
Added: svn:executable
   + *



More information about the moab-dev mailing list