[MOAB-dev] r4192 - MOAB/trunk/tools/mbcoupler
smithrm at mcs.anl.gov
smithrm at mcs.anl.gov
Tue Oct 5 11:49:24 CDT 2010
Author: smithrm
Date: 2010-10-05 11:49:23 -0500 (Tue, 05 Oct 2010)
New Revision: 4192
Modified:
MOAB/trunk/tools/mbcoupler/ElemUtil.cpp
MOAB/trunk/tools/mbcoupler/ElemUtil.hpp
Log:
o Added interface to evaluate a vertex based scalar field over a trilinear hex element.
o Added prototype object for a LinearTetMap. This may be changed.
Modified: MOAB/trunk/tools/mbcoupler/ElemUtil.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/ElemUtil.cpp 2010-10-04 14:49:12 UTC (rev 4191)
+++ MOAB/trunk/tools/mbcoupler/ElemUtil.cpp 2010-10-05 16:49:23 UTC (rev 4192)
@@ -48,6 +48,7 @@
LinearHexMap( const CartVect* corner_coords ) : corners(corner_coords) {}
virtual CartVect center_xi() const;
virtual CartVect evaluate( const CartVect& xi ) const;
+ virtual double evaluate_scalar_field( const CartVect& xi, const double *f_vals ) const;
virtual Matrix3 jacobian( const CartVect& xi ) const;
private:
const CartVect* corners;
@@ -78,6 +79,19 @@
return x;
}
+double LinearHexMap::evaluate_scalar_field( const CartVect& xi, const double *f_vals ) const
+{
+ double f(0.0);
+ for (unsigned i = 0; i < 8; ++i) {
+ const double N_i = (1 + xi[0]*corner_xi[i][0])
+ * (1 + xi[1]*corner_xi[i][1])
+ * (1 + xi[2]*corner_xi[i][2]);
+ f += N_i * f_vals[i];
+ }
+ f *= 0.125;
+ return f;
+}
+
Matrix3 LinearHexMap::jacobian( const CartVect& xi ) const
{
Matrix3 J(0.0);
@@ -101,6 +115,55 @@
return J *= 0.125;
}
+/**\brief Shape function for linear tetrahedron */
+class LinearTetMap : public VolMap {
+ public:
+ LinearTetMap( const CartVect* corner_coords ) : corners(corner_coords) {}
+ virtual CartVect center_xi() const;
+ virtual CartVect evaluate( const CartVect& xi ) const;
+ virtual Matrix3 jacobian( const CartVect& xi ) const;
+ private:
+ const CartVect* corners;
+ static const double corner_xi[8][3];
+};
+
+const double LinearTetMap::corner_xi[8][3] = { { -1, -1, -1 },
+ { 1, -1, -1 },
+ { 0, 1, -1 },
More information about the moab-dev
mailing list