[MOAB-dev] r1869 - in MOAB/trunk: . tools tools/iMesh/SIDL tools/mcnpmit

tautges at mcs.anl.gov tautges at mcs.anl.gov
Tue Jun 3 17:04:40 CDT 2008


Author: tautges
Date: 2008-06-03 17:04:40 -0500 (Tue, 03 Jun 2008)
New Revision: 1869

Removed:
   MOAB/trunk/MBElemUtil.cpp
   MOAB/trunk/MBElemUtil.hpp
Modified:
   MOAB/trunk/MBGeomUtil.cpp
   MOAB/trunk/Makefile.am
   MOAB/trunk/configure.in
   MOAB/trunk/tools/Makefile.am
   MOAB/trunk/tools/iMesh/SIDL/Makefile.in
   MOAB/trunk/tools/mcnpmit/Makefile.am
   MOAB/trunk/tools/mcnpmit/main.cpp
Log:
Moving the coupling stuff to its own tool under tools/mbcoupler.



Deleted: MOAB/trunk/MBElemUtil.cpp
===================================================================
--- MOAB/trunk/MBElemUtil.cpp	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/MBElemUtil.cpp	2008-06-03 22:04:40 UTC (rev 1869)
@@ -1,133 +0,0 @@
-#include <iostream>
-#include <assert.h>
-
-#include "MBElemUtil.hpp"
-
-//
-// nat_coords_trilinear_hex
-// Given an MBEntityHandle defining a MBHEX element defined by a 
-// trilinear basis and a set of xyz points in space, it finds the 
-// cooresponding natural coordinates and returns them to the pointer
-// nat.  The method uses an iterative technique, guessing initial
-// coordinates {0, 0, 0} and calculating new coordinates based on the 
-// ones just calculated.
-// 
-void MBElemUtil::nat_coords_trilinear_hex(MBCartVect hex[8], 
-                                          MBCartVect xyz,
-                                          MBCartVect &ncoords,
-                                          double etol)       
-{
-
-      MBCartVect nat(0.);
-      double A[8]; double B[8]; double C[8]; double D[8];
-      double Ax, By, Cz;
-      double err = 1.e37;
-
-      double xt, yt, zt;
-      double nxi, neta, nmu;
-      double pxi, peta, pmu;
-      double tmp;
-
-      // Iterative estimate of natural coordinates
-      while ( err > etol ) {
-
-            // Estimate the xi-coordinate
-            A[0] = (1 - nat[1]) * (1 - nat[2]);
-            A[1] = A[0];
-            A[2] = (1 + nat[1]) * (1 - nat[2]);        
-            A[3] = A[2];    
-            A[4] = (1 - nat[1]) * (1 + nat[2]);
-            A[5] = A[4]; 
-            A[6] = (1 + nat[1]) * (1 + nat[2]);    
-            A[7] = A[6];
-
-            Ax = 0;
-            for (unsigned int i = 0; i < 8; i++) {
-                  Ax = Ax + A[i]*hex[i][0];
-            }
-            nat[0] = (8*xyz[0] - Ax ) / 
-                     (-A[0]*hex[0][0] + A[1]*hex[1][0] + A[2]*hex[2][0] - A[3]*hex[3][0] 
-                      -A[4]*hex[4][0] + A[5]*hex[5][0] + A[6]*hex[6][0] - A[7]*hex[7][0]);
-
-            // Estimate the eta-coordinate
-            B[0] = (1 - nat[0]) * (1 - nat[2]);
-            B[1] = (1 + nat[0]) * (1 - nat[2]);
-            B[2] = B[1];
-            B[3] = B[0];    
-            B[4] = (1 - nat[0]) * (1 + nat[2]);
-            B[5] = (1 + nat[0]) * (1 + nat[2]);
-            B[6] = B[5];   
-            B[7] = B[4];
-
-            By = 0;
-            for (unsigned int i = 0; i < 8; i++) {
-                  By = By + B[i]*hex[i][1];
-            }
-            nat[1] = (8*xyz[1] - By ) / 
-                     (-B[0]*hex[0][1] - B[1]*hex[1][1] + B[2]*hex[2][1] + B[3]*hex[3][1] 
-                      -B[4]*hex[4][1] - B[5]*hex[5][1] + B[6]*hex[6][1] + B[7]*hex[7][1]);
-
-            // Estimate the mu-coordinate
-            C[0] = (1 - nat[0]) * (1 - nat[1]);
-            C[1] = (1 + nat[0]) * (1 - nat[1]);
-            C[2] = (1 + nat[0]) * (1 + nat[1]);
-            C[3] = (1 - nat[0]) * (1 + nat[1]);     
-            C[4] = C[0];
-            C[5] = C[1];
-            C[6] = C[2];   
-            C[7] = C[3];
-
-            Cz = 0;
-            for (unsigned int i = 0; i < 8; i++) {
-                  Cz = Cz + C[i]*hex[i][2];
-            }
-            nat[2] = (8*xyz[2] - Cz ) / 
-                     (-C[0]*hex[0][2] - C[1]*hex[1][2] - C[2]*hex[2][2] - C[3]*hex[3][2] 
-                      +C[4]*hex[4][2] + C[5]*hex[5][2] + C[6]*hex[6][2] + C[7]*hex[7][2]); 
-
-
-            // Shortcut variables...
-            nxi  = 1 - nat[0];
-            neta = 1 - nat[1];
-            nmu  = 1 - nat[2];
-            pxi  = 1 + nat[0];
-            peta = 1 + nat[1];
-            pmu  = 1 + nat[2];
-	    D[0] = nxi * neta * nmu;
-	    D[1] = pxi * neta * nmu;
-	    D[2] = pxi * peta * nmu;
-	    D[3] = nxi * peta * nmu;
-	    D[4] = nxi * neta * pmu;
-	    D[5] = pxi * neta * pmu;
-	    D[6] = pxi * peta * pmu;
-	    D[7] = nxi * peta * pmu;
-
-            // Compute corresponding estimates for x, y, and z to check               
-            xt = 0.125 * ( D[0] * hex[0][0] + D[1] * hex[1][0] + 
-                           D[2] * hex[2][0] + D[3] * hex[3][0] + 
-                           D[4] * hex[4][0] + D[5] * hex[5][0] + 
-                           D[6] * hex[6][0] + D[7] * hex[7][0] );
-
-            yt = 0.125 * ( D[0] * hex[0][1] + D[1] * hex[1][1] + 
-                           D[2] * hex[2][1] + D[3] * hex[3][1] + 
-                           D[4] * hex[4][1] + D[5] * hex[5][1] + 
-                           D[6] * hex[6][1] + D[7] * hex[7][1] );
-
-            zt = 0.125 * ( D[0] * hex[0][2] + D[1] * hex[1][2] + 
-                           D[2] * hex[2][2] + D[3] * hex[3][2] + 
-                           D[4] * hex[4][2] + D[5] * hex[5][2] + 
-                           D[6] * hex[6][2] + D[7] * hex[7][2] );
-
-            // Compute error
-            err = fabs(xt - xyz[0]);
-            tmp = fabs(yt - xyz[1]);
-            if (tmp > err) err = tmp;
-            tmp = fabs(zt - xyz[2]);
-            if (tmp > err) err = tmp;
-
-      }
-
-      ncoords = nat;
-      return;
-
-}

Deleted: MOAB/trunk/MBElemUtil.hpp
===================================================================
--- MOAB/trunk/MBElemUtil.hpp	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/MBElemUtil.hpp	2008-06-03 22:04:40 UTC (rev 1869)
@@ -1,12 +0,0 @@
-#include "MBCore.hpp"
-#include "MBCartVect.hpp"
-
-class MBElemUtil {
-
-  public:
-
-  static void nat_coords_trilinear_hex(MBCartVect[8], 
-                                       MBCartVect, 
-                                       MBCartVect&,
-                                       double);
-};

Modified: MOAB/trunk/MBGeomUtil.cpp
===================================================================
--- MOAB/trunk/MBGeomUtil.cpp	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/MBGeomUtil.cpp	2008-06-03 22:04:40 UTC (rev 1869)
@@ -21,11 +21,11 @@
 #include "MBCartVect.hpp"
 #include "MBCN.hpp"
 #include "MBGeomUtil.hpp"
-#include "MBElemUtil.hpp"
 #include <cmath>
 #include <algorithm>
 #include <assert.h>
 #include <iostream>
+#include <limits>
 
 #ifdef _MSC_VER
 #  include <float.h>
@@ -922,46 +922,4 @@
   return closest % closest < tolerance * tolerance;
 }
 
-bool point_in_trilinear_hex(MBCartVect hex[8], 
-                            MBCartVect xyz,
-                            double etol) 
-{
-
-      const double one = 1.000001;
-
-      MBCartVect  nat(0.);
-      MBElemUtil::nat_coords_trilinear_hex(hex, xyz, nat, etol);
-      
-      for (unsigned int i = 0; i < 3; i++) {
-            if ((nat[i] > one) || (nat[i] < -one)) return false;
-      }
-
-      return true;
-
-}
-
-
-bool point_in_trilinear_hex(MBCartVect hex[8], 
-                            MBCartVect xyz, 
-                            MBCartVect box_min, MBCartVect box_max,
-                            double etol) 
-{
-
-      const double one = 1.000001;
-
-      if ((xyz[0] < box_min[0]) || (xyz[0] > box_max[0])) return false;
-      if ((xyz[1] < box_min[1]) || (xyz[1] > box_max[1])) return false;
-      if ((xyz[2] < box_min[2]) || (xyz[2] > box_max[2])) return false;
-
-      MBCartVect  nat(0.);
-      MBElemUtil::nat_coords_trilinear_hex(hex, xyz, nat, etol);
-      
-      for (unsigned int i = 0; i < 3; i++) {
-            if ((nat[i] > one) || (nat[i] < -one)) return false;
-      }
-
-      return true;
-
-}
-
 } // namespace MBGeoemtry

Modified: MOAB/trunk/Makefile.am
===================================================================
--- MOAB/trunk/Makefile.am	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/Makefile.am	2008-06-03 22:04:40 UTC (rev 1869)
@@ -11,7 +11,7 @@
 if PARALLEL
   SUBDIRS += parallel
 endif
-SUBDIRS += . test tools doc doxygen
+SUBDIRS += . test tools doc doxygen 
 
 
 # Things to build
@@ -40,7 +40,7 @@
 check_PROGRAMS = $(TESTS) \
 		 kd_tree_tool \
 		 kd_tree_time
-         
+
 if PARALLEL 
   check_PROGRAMS += mbparallelcomm_test
 endif
@@ -125,7 +125,6 @@
   MBCN.cpp \
   MBCNArrays.hpp \
   MBCartVect.cpp \
-  MBElemUtil.cpp \
   MBHandleUtils.cpp \
   MBMatrix3.cpp \
   MBMatrix3.hpp \
@@ -222,7 +221,6 @@
   MBCN_protos.h \
   MBCartVect.hpp \
   MBCore.hpp \
-  MBElemUtil.hpp \
   MBEntityType.h \
   MBEntityHandle.h \
   MBError.hpp \

Modified: MOAB/trunk/configure.in
===================================================================
--- MOAB/trunk/configure.in	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/configure.in	2008-06-03 22:04:40 UTC (rev 1869)
@@ -237,6 +237,7 @@
 MB_OPTIONAL_TOOL([mbconvert],    [yes])
 MB_OPTIONAL_TOOL([hexmodops],    [yes])
 MB_OPTIONAL_TOOL([mbchaco],      [no] )
+MB_OPTIONAL_TOOL([mbcoupler],    [no] )
 MB_OPTIONAL_TOOL([mbperf],       [yes])
 MB_OPTIONAL_TOOL([qvdual],       [no] )
 MB_OPTIONAL_TOOL([mbsize],       [yes])
@@ -819,6 +820,7 @@
                  tools/iMesh/SIDL/common.make
                  tools/mbperf/Makefile
                  tools/mbchaco/Makefile
+                 tools/mbcoupler/Makefile
 		 tools/mbzoltan/Config.moab
 		 tools/mbzoltan/Makefile
 		 tools/mcnpmit/Makefile

Modified: MOAB/trunk/tools/Makefile.am
===================================================================
--- MOAB/trunk/tools/Makefile.am	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/tools/Makefile.am	2008-06-03 22:04:40 UTC (rev 1869)
@@ -19,6 +19,11 @@
 else
   mbchaco_DIR=
 endif
+if ENABLE_mbcoupler
+  mbcoupler_DIR = mbcoupler
+else
+  mbcoupler_DIR=
+endif
 if ENABLE_mbzoltan
   mbzoltan_DIR = mbzoltan
 else
@@ -83,6 +88,7 @@
 	  $(converter_DIR) \
           $(hexmodops_DIR) \
           $(mbchaco_DIR) \
+          $(mbcoupler_DIR) \
           $(mbzoltan_DIR) \
           $(mbperf_DIR) \
 	  $(mcnpmit_DIR) \

Modified: MOAB/trunk/tools/iMesh/SIDL/Makefile.in
===================================================================
--- MOAB/trunk/tools/iMesh/SIDL/Makefile.in	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/tools/iMesh/SIDL/Makefile.in	2008-06-03 22:04:40 UTC (rev 1869)
@@ -1,8 +1,8 @@
 @SET_MAKE@
 
 MAKE_INC = iMesh-SIDL-Defs.inc
-SIDL_FILES = iBase.sidl iMesh.sidl iMesh_SIDL.sidl
-SIDL_FILES_PATH = $(srcdir)/iBase.sidl $(srcdir)/iMesh.sidl $(srcdir)/iMesh_SIDL.sidl
+SIDL_FILES = iBase.sidl iMeshS.sidl iMeshS_SIDL.sidl
+SIDL_FILES_PATH = $(srcdir)/iBase.sidl $(srcdir)/iMeshS.sidl $(srcdir)/iMeshS_SIDL.sidl
 SERVER_FILES = mserver/iBase_Error_Impl.cc \
                mserver/iBase_Error_Impl.hh \
 	       mserver/iMesh_SIDL_MeshSidl_Impl.cc \

Modified: MOAB/trunk/tools/mcnpmit/Makefile.am
===================================================================
--- MOAB/trunk/tools/mcnpmit/Makefile.am	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/tools/mcnpmit/Makefile.am	2008-06-03 22:04:40 UTC (rev 1869)
@@ -1,7 +1,7 @@
 AUTOMAKE_OPTIONS = foreign
 DEFS = $(DEFINES)
-INCLUDES += -I$(top_srcdir) -I$(top_builddir)
+INCLUDES += -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/tools/mbcoupler
 bin_PROGRAMS = mcnpmit
 mcnpmit_SOURCES = mcnpmit.hpp mcnpmit.cpp main.cpp
-LDADD = $(top_builddir)/libMOAB.la
-mcnpmit_DEPENDENCIES = $(top_builddir)/libMOAB.la
+LDADD = $(top_builddir)/libMOAB.la $(top_builddir)/tools/mbcoupler/libmbcoupler.la
+mcnpmit_DEPENDENCIES = $(top_builddir)/libMOAB.la $(top_builddir)/tools/mbcoupler/libmbcoupler.la

Modified: MOAB/trunk/tools/mcnpmit/main.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/main.cpp	2008-06-02 18:49:17 UTC (rev 1868)
+++ MOAB/trunk/tools/mcnpmit/main.cpp	2008-06-03 22:04:40 UTC (rev 1869)
@@ -12,6 +12,7 @@
 #include "MBTagConventions.hpp"
 #include "MBAdaptiveKDTree.hpp"
 #include "MBGeomUtil.hpp"
+#include "MBElemUtil.hpp"
 
 #define MBI mb_instance()
 
@@ -247,7 +248,7 @@
 	  hexverts[j][2] = coords[3*j+2];
       }
 
-      if (MBGeomUtil::point_in_trilinear_hex(hexverts, testvc, 1.e-6)) {
+      if (MBElemUtil::point_in_trilinear_hex(hexverts, testvc, 1.e-6)) {
     	  MBresult = MBI -> tag_get_data( MCNP->tally_tag, &(*rit), 1, &taldata);
 	  outfile <<   n         << ","
 	            << testpt[0] << ","




More information about the moab-dev mailing list