[MOAB-dev] commit/MOAB: tautges: More changes for minimizing files touched in my upcoming pull request.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Sep 13 15:20:12 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/2730974376d3/
Changeset:   2730974376d3
Branch:      master
User:        tautges
Date:        2013-09-13 22:20:03
Summary:     More changes for minimizing files touched in my upcoming pull request.

ScdInterface, FileOptions: minor cosmetic changes
Core.hpp, Interface.hpp: clarifying comments on arguments whose name changed
scdtest2.cpp: not tested anyway
ElemUtil: declaring/implementing proper (virtual) destructors to eliminate warnings

Passes distcheck (thanks Iulian) and debug/optimized/parallel checks.

Affected #:  7 files

diff --git a/src/ScdInterface.cpp b/src/ScdInterface.cpp
index 4dd7c5b..1d42dde 100644
--- a/src/ScdInterface.cpp
+++ b/src/ScdInterface.cpp
@@ -147,12 +147,10 @@ ErrorCode ScdInterface::construct_box(HomCoord low, HomCoord high, const double
 
     // set the vertex coordinates
   double *xc, *yc, *zc;
-
   rval = new_box->get_coordinate_arrays(xc, yc, zc);
   ERRORR(rval, "Couldn't get vertex coordinate arrays.");
 
   if (coords && num_coords) {
-
     unsigned int i = 0;
     for (int kl = low[2]; kl <= high[2]; kl++) {
       for (int jl = low[1]; jl <= high[1]; jl++) {

diff --git a/src/moab/Core.hpp b/src/moab/Core.hpp
index 4bb86c8..aa7d9da 100644
--- a/src/moab/Core.hpp
+++ b/src/moab/Core.hpp
@@ -216,16 +216,17 @@ public:
   
       //! Gets the connectivity for an element EntityHandle. 
       /** For non-element handles (ie, MeshSets), 
-          returns an error. Connectivity data is copied from the database into the vector 
-          <em>connectivity</em>. The nodes in <em>connectivity</em> are properly ordered.
-          \param entity_handle EntityHandle to get connectivity of.
-          \param connectivity Vector in which connectivity of <em>entity_handle</em> is returned.  
-          Should contain MeshVertices.
-          \param corners_only If true, higher order nodes are ignored. 
-
-          Example: \code 
-          std::vector<EntityHandle> conn;
-          get_connectivity( entity_handle, conn ); \endcode */
+       * returns an error. Connectivity data is copied from the database into the vector 
+       *   <em>connectivity</em>. The nodes in <em>connectivity</em> are properly ordered.
+       *  \param entity_handle EntityHandle to get connectivity of.
+       *  \param connectivity Vector in which connectivity of <em>entity_handle</em> is returned.  
+       *   Should contain MeshVertices.
+       *  \param corners_only If true, returns only corner vertices, otherwise returns all of them (including any higher-order vertices)
+       *
+       *   Example: \code 
+       *   std::vector<EntityHandle> conn;
+       *   get_connectivity( entity_handle, conn ); \endcode 
+       */
     virtual ErrorCode  get_connectivity(const EntityHandle *entity_handles, 
                                         const int num_handles,
                                         std::vector<EntityHandle> &connectivity, 

diff --git a/src/moab/FileOptions.hpp b/src/moab/FileOptions.hpp
index 85b3eef..722c9fe 100644
--- a/src/moab/FileOptions.hpp
+++ b/src/moab/FileOptions.hpp
@@ -42,7 +42,7 @@ public:
    *          the beginning of the string (semicolon followed by
    *          destired separator character.)
    */
-  FileOptions( const char* option_string );
+  FileOptions( const char* option_string);
   
   FileOptions( const FileOptions& copy );
   FileOptions& operator=( const FileOptions& copy );

diff --git a/src/moab/Interface.hpp b/src/moab/Interface.hpp
index b6bb3e5..09f4219 100644
--- a/src/moab/Interface.hpp
+++ b/src/moab/Interface.hpp
@@ -527,7 +527,7 @@ public:
         \param entity_handles Vector of element handles to get connectivity of.
         \param num_handles Number of entity handles in <em>entity_handles</em>
         \param connectivity Vector in which connectivity of <em>entity_handles</em> is returned.  
-        \param corners_only If true, higher order nodes are ignored. 
+        \param corners_only If true, returns only corner vertices, otherwise returns all of them (including any higher-order vertices)
         \param offsets If non-NULL, offsets->[i] stores the index of the start of entity i's connectivity,
                 with the last value in offsets one beyond the last entry
     */
@@ -561,8 +561,7 @@ public:
         \param entity_handle EntityHandle to get connectivity of.
         \param connectivity Array in which connectivity of <em>entity_handle</em> is returned.
         \param num_nodes Number of MeshVertices in array <em>connectivity</em>. 
-        \param corners_only If true, num_nodes will be set to number of corner vertices
-        for that element type.
+        \param corners_only If true, returns only corner vertices, otherwise returns all of them (including any higher-order vertices)
         \param storage Some elements (e.g. structured mesh) may not have an
                        explicit connectivity list.  This function will normally
                        return MB_NOT_IMPLEMENTED for such elements.  However,

diff --git a/test/scdtest2.cpp b/test/scdtest2.cpp
deleted file mode 100644
index e744746..0000000
--- a/test/scdtest2.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "moab/ScdInterface.hpp"
-#include "moab/Core.hpp"
-#include "TestUtil.hpp"
-
-#include <iostream>
-
-#ifdef USE_MPI
-#include "moab/ParallelComm.hpp"
-#endif
-
-using namespace moab;
-
-void test_john()
-{
-  Core moab;
-  ScdInterface *scd;
-  ErrorCode rval = moab.Interface::query_interface(scd);
-  CHECK_ERR(rval);
-  int gdims[] = {0, 0, 0, 48, 40, 0};
-  int ldims[6];
-
-  std::cout << "x dims are " << gdims[3] << "\n";
-  std::cout << "y dims are " << gdims[4] << "\n";
-  
-#ifdef USE_MPI
-  ParallelComm pcomm(&moab, MPI_COMM_WORLD);
-  int procs = pcomm.proc_config().proc_size(),
-      rank = pcomm.proc_config().proc_rank();
-  ScdParData pardata;
-  std::copy(gdims, gdims+6, pardata.gDims);
-  pardata.gPeriodic[0] = pardata.gPeriodic[1] = 0;
-  pardata.partMethod = ScdParData::SQIJ;
-  int pDims[2];
-  
-  rval = ScdInterface::compute_partition(procs, rank, pardata, ldims, NULL, pDims); CHECK_ERR(rval);
-  std::cout << "processors in x are " << pDims[0] << "\n";
-  std::cout << "processors in y are " << pDims[1] << "\n";
-#else
-  std::copy(gdims, gdims+6, ldims);
-#endif
-
-  std::cout << "local dims are " 
-            << ldims[0] << " " << ldims[1] << " " << ldims[2] << " " 
-            << ldims[3] << " " << ldims[4] << " " << ldims[5] << "\n";
-
-  ScdBox* box;
-
-#ifdef USE_MPI
-  rval = scd->construct_box(HomCoord(ldims, 3), HomCoord(ldims+3, 3), NULL, 0, box, NULL, &pardata); CHECK_ERR(rval);
-  rval = pcomm.resolve_shared_ents(0); CHECK_ERR(rval);
-#else
-  rval = scd->construct_box(HomCoord(ldims, 3), HomCoord(ldims+3, 3), NULL, 0, box); CHECK_ERR(rval);
-#endif
-
-  moab.list_entities(0,0);
-  std::vector<EntityHandle> conn;
-  Range quads, verts;
-  rval = moab.get_entities_by_type(0, MBQUAD, quads); CHECK_ERR(rval);
-  rval = moab.get_adjacencies(quads, 0, false, verts, Interface::UNION); CHECK_ERR(rval);
-  Tag gid_tag;
-  rval = moab.tag_get_handle("GLOBAL_ID", gid_tag); CHECK_ERR(rval);
-  int *qgids, *vgids, count;
-  rval = moab.tag_iterate(gid_tag, quads.begin(), quads.end(), count, (void*&)qgids); 
-  CHECK_ERR(rval); CHECK_EQUAL(count, (int)quads.size());
-  rval = moab.tag_iterate(gid_tag, verts.begin(), verts.end(), count, (void*&)vgids); 
-  CHECK_ERR(rval); CHECK_EQUAL(count, (int)verts.size());
-  for (Range::iterator rit = quads.begin(); rit != quads.end(); rit++) {
-    rval = moab.get_connectivity(&(*rit), 1, conn); CHECK_ERR(rval);
-    std::cout << "Connectivity array for quad " << qgids[*rit-*quads.begin()] << " is: ";
-    for (int i = 0; i < 4; i++) std::cout << vgids[conn[i]-*verts.begin()] << " ";
-    std::cout << std::endl;
-  }
-  
-}
-
-int main(int, char**) 
-{
-    // test partition methods
-  RUN_TEST(test_john);
-}

diff --git a/tools/mbcoupler/ElemUtil.cpp b/tools/mbcoupler/ElemUtil.cpp
index 873cc44..cfc36e0 100644
--- a/tools/mbcoupler/ElemUtil.cpp
+++ b/tools/mbcoupler/ElemUtil.cpp
@@ -419,18 +419,20 @@ bool integrate_trilinear_hex(const CartVect* hex_corners,
 
 namespace Element {
 
+    Map::~Map() 
+    {}
+    
+    inline const std::vector<CartVect>& Map::get_vertices() {
+        return this->vertex;
+      }
+        //
+      void Map::set_vertices(const std::vector<CartVect>& v) {
+        if(v.size() != this->vertex.size()) {
+          throw ArgError();
+        }
+        this->vertex = v;
+      }
 
-
-  inline const std::vector<CartVect>& Map::get_vertices() {
-    return this->vertex;
-  }
-  //
-  void Map::set_vertices(const std::vector<CartVect>& v) {
-    if(v.size() != this->vertex.size()) {
-      throw ArgError();
-    }
-    this->vertex = v;
-  }// Map::set_vertices()
   //
   CartVect Map::ievaluate(const CartVect& x, double tol, const CartVect& x0) const {
     // TODO: should differentiate between epsilons used for
@@ -458,7 +460,6 @@ namespace Element {
     return xi;
   }// Map::ievaluate()
 
-
 // filescope for static member data that is cached
   const double LinearEdge::corner[2][3] = {  { -1, 0, 0 },
                                          {  1, 0, 0 } };
@@ -538,6 +539,8 @@ namespace Element {
 
   }// LinearHex::LinearHex()
 
+    LinearHex::~LinearHex() 
+    {}
   /* For each point, its weight and location are stored as an array.
      Hence, the inner dimension is 2, the outer dimension is gauss_count.
      We use a one-point Gaussian quadrature, since it integrates linear functions exactly.
@@ -653,6 +656,8 @@ namespace Element {
   QuadraticHex::QuadraticHex():Map(0) {
   }
 
+    QuadraticHex::~QuadraticHex() 
+    {}
   double SH(const int i, const double xi)
   {
     switch (i)
@@ -749,6 +754,9 @@ namespace Element {
   }// LinearTet::LinearTet()
 
 
+    LinearTet::~LinearTet() 
+    {}
+
   void LinearTet::set_vertices(const std::vector<CartVect>& v) {
     this->Map::set_vertices(v);
     this->T = Matrix3(v[1][0]-v[0][0],v[2][0]-v[0][0],v[3][0]-v[0][0],
@@ -1002,6 +1010,9 @@ namespace Element {
 
   }// LinearQuad::LinearQuad()
 
+    LinearQuad::~LinearQuad() 
+    {}
+    
   /* For each point, its weight and location are stored as an array.
      Hence, the inner dimension is 2, the outer dimension is gauss_count.
      We use a one-point Gaussian quadrature, since it integrates linear functions exactly.

diff --git a/tools/mbcoupler/ElemUtil.hpp b/tools/mbcoupler/ElemUtil.hpp
index 9b4bf9a..1db4c9e 100644
--- a/tools/mbcoupler/ElemUtil.hpp
+++ b/tools/mbcoupler/ElemUtil.hpp
@@ -71,10 +71,11 @@ namespace ElemUtil {
       Map(const std::vector<CartVect>& v) {this->vertex.resize(v.size()); this->set_vertices(v);};
       /**\brief Construct a Map defined by n vertices. */
       Map(const unsigned int n) {this->vertex = std::vector<CartVect>(n);};
+      virtual ~Map();
       /**\brief Evaluate the map on \xi (calculate $\vec x = F($\vec \xi)$ )*/
       virtual CartVect evaluate( const CartVect& xi ) const = 0;
       /**\brief Evaluate the inverse map (calculate $\vec \xi = F^-1($\vec x)$ to given tolerance)*/
-      CartVect ievaluate( const CartVect& x, double tol, const CartVect& x0 = CartVect(0.0)) const ;
+      virtual CartVect ievaluate( const CartVect& x, double tol, const CartVect& x0 = CartVect(0.0)) const ;
       /**\brief decide if within the natural param space, with a tolerance*/
       virtual bool inside_nat_space(const CartVect & xi, double & tol) const = 0;
       /* FIX: should evaluate and ievaluate return both the value and the Jacobian (first jet)? */
@@ -98,7 +99,7 @@ namespace ElemUtil {
       /**\brief Size of the vertices vector. */
       unsigned int size() {return this->vertex.size();}
       /**\brief Retrieve vertices. */
-      inline const std::vector<CartVect>& get_vertices();
+      const std::vector<CartVect>& get_vertices();
       /**\brief Set vertices.      */
       virtual void set_vertices(const std::vector<CartVect>& v);
 
@@ -122,13 +123,15 @@ namespace ElemUtil {
     public:
       LinearHex(const std::vector<CartVect>& vertices) : Map(vertices){};
       LinearHex();
+      virtual ~LinearHex();
+      
       virtual CartVect evaluate( const CartVect& xi ) const;
       //virtual CartVect ievaluate(const CartVect& x, double tol) const ;
       virtual bool inside_nat_space(const CartVect & xi, double & tol) const;
 
       virtual Matrix3  jacobian(const CartVect& xi) const;
-      double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
-      double   integrate_scalar_field(const double *field_vertex_values) const;
+      virtual double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
+      virtual double   integrate_scalar_field(const double *field_vertex_values) const;
 
     protected:
       /* Preimages of the vertices -- "canonical vertices" -- are known as "corners". */
@@ -144,13 +147,14 @@ namespace ElemUtil {
     public:
       QuadraticHex(const std::vector<CartVect>& vertices) : Map(vertices){};
       QuadraticHex();
+      virtual ~QuadraticHex();
       virtual CartVect evaluate( const CartVect& xi ) const;
       //virtual CartVect ievaluate(const CartVect& x, double tol) const ;
       virtual bool inside_nat_space(const CartVect & xi, double & tol) const;
 
       virtual Matrix3  jacobian(const CartVect& xi) const;
-      double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
-      double   integrate_scalar_field(const double *field_vertex_values) const;
+      virtual double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
+      virtual double   integrate_scalar_field(const double *field_vertex_values) const;
 
     protected:
       /* Preimages of the vertices -- "canonical vertices" -- are known as "corners".
@@ -166,6 +170,7 @@ namespace ElemUtil {
     public:
       LinearTet(const std::vector<CartVect>& vertices) : Map(vertices){};
       LinearTet();
+      virtual ~LinearTet();
       /* Override the evaluation routines to take advantage of the properties of P1. */
       virtual CartVect evaluate(const CartVect& xi) const {return this->vertex[0] + this->T*xi;};
       virtual CartVect ievaluate(const CartVect& x) const {return this->T_inverse*(x-this->vertex[0]);};
@@ -174,12 +179,12 @@ namespace ElemUtil {
       virtual double   det_jacobian(const CartVect& )  const {return this->det_T;};
       virtual double   det_ijacobian(const CartVect& ) const {return this->det_T_inverse;};
       //
-      double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
-      double   integrate_scalar_field(const double *field_vertex_values) const;
+      virtual double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
+      virtual double   integrate_scalar_field(const double *field_vertex_values) const;
       //
       /* Override set_vertices so we can precompute the matrices effecting the mapping to and from the canonical simplex. */
-      void     set_vertices(const std::vector<CartVect>& v);
-      bool inside_nat_space(const CartVect & xi, double & tol) const;
+      virtual void     set_vertices(const std::vector<CartVect>& v);
+      virtual bool inside_nat_space(const CartVect & xi, double & tol) const;
     protected:
       static const double corner[4][3];
       Matrix3 T, T_inverse;
@@ -225,13 +230,14 @@ namespace ElemUtil {
     public:
       LinearQuad(const std::vector<CartVect>& vertices) : Map(vertices){};
       LinearQuad();
+      virtual ~LinearQuad();
       virtual CartVect evaluate( const CartVect& xi ) const;
       //virtual CartVect ievaluate(const CartVect& x, double tol) const ;
       virtual bool inside_nat_space(const CartVect & xi, double & tol) const;
 
       virtual Matrix3  jacobian(const CartVect& xi) const;
-      double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
-      double   integrate_scalar_field(const double *field_vertex_values) const;
+      virtual double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
+      virtual double   integrate_scalar_field(const double *field_vertex_values) const;
 
     protected:
       /* Preimages of the vertices -- "canonical vertices" -- are known as "corners". */
@@ -252,8 +258,8 @@ namespace ElemUtil {
       virtual bool inside_nat_space(const CartVect & xi, double & tol) const;
 
       virtual Matrix3  jacobian(const CartVect& xi) const;
-      double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
-      double   integrate_scalar_field(const double *field_vertex_values) const;
+      virtual double   evaluate_scalar_field(const CartVect& xi, const double *field_vertex_values) const;
+      virtual double   integrate_scalar_field(const double *field_vertex_values) const;
 
     protected:
       /* Preimages of the vertices -- "canonical vertices" -- are known as "corners". */

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