[MOAB-dev] r1491 - MOAB/trunk/refiner
dcthomp at mcs.anl.gov
dcthomp at mcs.anl.gov
Thu Dec 27 11:13:45 CST 2007
Author: dcthomp
Date: 2007-12-27 11:13:44 -0600 (Thu, 27 Dec 2007)
New Revision: 1491
Modified:
MOAB/trunk/refiner/MBEdgeSizeEvaluator.cpp
MOAB/trunk/refiner/MBEdgeSizeEvaluator.hpp
MOAB/trunk/refiner/MBEntityRefiner.cpp
MOAB/trunk/refiner/MBEntityRefiner.hpp
MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp
MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp
Log:
ENH: Refiner checkpoint
Modified: MOAB/trunk/refiner/MBEdgeSizeEvaluator.cpp
===================================================================
--- MOAB/trunk/refiner/MBEdgeSizeEvaluator.cpp 2007-12-27 10:02:36 UTC (rev 1490)
+++ MOAB/trunk/refiner/MBEdgeSizeEvaluator.cpp 2007-12-27 17:13:44 UTC (rev 1491)
@@ -4,6 +4,7 @@
#include <assert.h>
+/// Construct an evaluator.
MBEdgeSizeEvaluator::MBEdgeSizeEvaluator( MBInterface* parentMesh )
{
assert( parentMesh );
@@ -12,16 +13,40 @@
this->reset_vertex_tags();
}
+/// Destruction is virtual so subclasses may clean up after refinement.
MBEdgeSizeEvaluator::~MBEdgeSizeEvaluator()
{
}
+/**\fn bool MBEdgeSizeEvaluator::evaluate_edge( \
+ * const double* p0, const void* t0, double* p1, void* t1, const double* p2, const void* t2 )
+ *\brief Returns true if the edge \a p0 - \a p2 should be subdivided, false otherwise.
+ *
+ * The arguments \a p0, \a p1, and \a p2 are all pointers to arrays of 6 doubles each
+ * while the arguments \a t0, \a t1, and \a t2 are all pointers to arrays of tag data
+ * defined at the corresponding point. While the endpoints \a p0 and \a p2 are
+ * immutable, the mid-edge point coordinates \a p1 and tag data \a t1 may be altered by
+ * evaluate_edge(). Altered values will be ignored if evaluate_edge() returns false.
+ * Be careful to ensure that all calls to evaluate_edge() perform identical modifications
+ * given identical input values!
+ *
+ * A list of tags passed in \a t0, \a t1, and \a t2 is stored in the vertexTags member.
+ * The vertexSize member stores the total length of data associated with each pointer (in bytes).
+ * Subclasses may access vertexTags and vertexSize directly; the refiner uses public methods to
+ * populate vertexTags before evaluate_edge() is called.
+ */
+
+/// Clear the list of tag values that will appear past the vertex coordinates in \a p0, \a p1, and \a p2.
void MBEdgeSizeEvaluator::reset_vertex_tags()
{
this->vertexSize = 0;
this->vertexTags.clear();
}
+/** Add a tag to the list of tag values that will appear past the vertex coordinates.
+ * The return value is the offset into each vertex coordinate pointer (\a p0, \a p1, \a p2) where the
+ * tag value(s) will be stored.
+ */
int MBEdgeSizeEvaluator::add_vertex_tag( MBTag tag_handle )
{
int offset = this->vertexSize; // old size is offset of tag being added
@@ -48,3 +73,27 @@
this->vertexTags.push_back( std::pair< MBTag, int >( tag_handle, offset ) );
return offset;
}
+
+/**\fn int MBEdgeSizeEvaluator::get_vertex_tag_size()
+ *\brief Return the number of bytes to allocate for tag data per point.
+ */
+
+/**\brief Given endpoint coordinates and tag values plus midpoint coordinates, compute midpoint tag values.
+ *
+ * Normally, this function will be invoked by the MBEntityRefiner before evaluate_edge is called.
+ * However, if evaluate_edge() changes the parametric coordinates of the midpoint,
+ * it should call evaluate_tags_at_midpoint() again to update any tag values;
+ * that is why this function is a member of MBEdgeSizeEvaluator and not MBEntityRefiner.
+ *
+ * @param[in] c0 Pointer to endpoint 0 coordinates. The parametric coordinates (3) are followed by world coordinates (3).
+ * @param[in] t0 Pointer to endpoint 0 tag values.
+ * @param[in] cm Pointer to midpoint coordinates. The parametric coordinates (3) are followed by world coordinates (3).
+ * @param[out] tm Pointer to midpoint tag values.
+ * @param[in] c1 Pointer to endpoint 1 coordinates. The parametric coordinates (3) are followed by world coordinates (3).
+ * @param[in] t1 Pointer to endpoint 1 tag values.
+ */
+void MBEdgeSizeEvaluator::evaluate_tags_at_midpoint(
+ const double* c0, const void* t0, double* cm, void* tm, const double* c1, const void* t1 ) const
+{
+}
+
Modified: MOAB/trunk/refiner/MBEdgeSizeEvaluator.hpp
===================================================================
--- MOAB/trunk/refiner/MBEdgeSizeEvaluator.hpp 2007-12-27 10:02:36 UTC (rev 1490)
+++ MOAB/trunk/refiner/MBEdgeSizeEvaluator.hpp 2007-12-27 17:13:44 UTC (rev 1491)
@@ -35,40 +35,21 @@
class MB_DLL_EXPORT MBEdgeSizeEvaluator
{
public:
- /// Construct an evaluator.
MBEdgeSizeEvaluator( MBInterface* );
- /// Destruction is virtual so subclasses may clean up after refinement.
virtual ~MBEdgeSizeEvaluator();
- /** \brief Returns true if the edge \a p0 - \a p2 should be subdivided, false otherwise.
- *
- * The arguments \a p0, \a p1, and \a p2 are all pointers to arrays of 6 doubles each
- * while the arguments \a t0, \a t1, and \a t2 are all pointers to arrays of tag data
- * defined at the corresponding point. While the endpoints \a p0 and \a p2 are
- * immutable, the mid-edge point coordinates \a p1 and tag data \a t1 may be altered by
- * evaluate_edge(). Altered values will be ignored if evaluate_edge() returns false.
- * Be careful to ensure that all calls to evaluate_edge() perform identical modifications
- * given identical input values!
- *
- * A list of tags passed in \a t0, \a t1, and \a t2 is stored in the vertexTags member.
- * The vertexSize member stores the total length of data associated with each pointer (in bytes).
- * Subclasses may access vertexTags and vertexSize directly; the refiner uses public methods to
- * populate vertexTags before evaluate_edge() is called.
- */
virtual bool evaluate_edge(
const double* p0, const void* t0,
double* p1, void* t1,
const double* p2, const void* t2 ) = 0;
- /// Clear the list of tag values that will appear past the vertex coordinates in \a p0, \a p1, and \a p2.
void reset_vertex_tags();
- /** Add a tag to the list of tag values that will appear past the vertex coordinates.
- * The return value is the offset into each vertex coordinate pointer (\a p0, \a p1, \a p2) where the
- * tag value(s) will be stored.
- */
int add_vertex_tag( MBTag tag_handle );
- /// Return the number of bytes to allocate for tag data per point.
int get_vertex_tag_size() { return this->vertexSize; }
+ void evaluate_tags_at_midpoint(
+ const double* c0, const void* t0,
+ double* cm, void* tm,
+ const double* c1, const void* t1 ) const;
protected:
std::vector< std::pair< MBTag, int > > vertexTags;
Modified: MOAB/trunk/refiner/MBEntityRefiner.cpp
===================================================================
--- MOAB/trunk/refiner/MBEntityRefiner.cpp 2007-12-27 10:02:36 UTC (rev 1490)
+++ MOAB/trunk/refiner/MBEntityRefiner.cpp 2007-12-27 17:13:44 UTC (rev 1491)
@@ -203,17 +203,3 @@
}
return rval;
}
-
-/**\brief Given endpoint coordinates and tag values plus midpoint coordinates, compute midpoint tag values.
- *
- * @param[in] c0 Pointer to endpoint 0 coordinates. The parametric coordinates (3) are followed by world coordinates (3).
- * @param[in] t0 Pointer to endpoint 0 tag values.
- * @param[in] cm Pointer to midpoint coordinates. The parametric coordinates (3) are followed by world coordinates (3).
- * @param[out] tm Pointer to midpoint tag values.
- * @param[in] c1 Pointer to endpoint 1 coordinates. The parametric coordinates (3) are followed by world coordinates (3).
- * @param[in] t1 Pointer to endpoint 1 tag values.
- */
-void MBEntityRefiner::evaluate_tags_at_midpoint(
- const double* c0, const void* t0, double* cm, void* tm, const double* c1, const void* t1 ) const
-{
-}
Modified: MOAB/trunk/refiner/MBEntityRefiner.hpp
===================================================================
--- MOAB/trunk/refiner/MBEntityRefiner.hpp 2007-12-27 10:02:36 UTC (rev 1490)
+++ MOAB/trunk/refiner/MBEntityRefiner.hpp 2007-12-27 17:13:44 UTC (rev 1491)
@@ -109,7 +109,6 @@
void reset_heap_pointers();
double* heap_coord_storage();
void* heap_tag_storage();
- void evaluate_tags_at_midpoint( const double* c0, const void* t0, double* cm, void* tm, const double* c1, const void* t1 ) const;
};
#endif // MB_ENTITYREFINER_H
Modified: MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp
===================================================================
--- MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp 2007-12-27 10:02:36 UTC (rev 1490)
+++ MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp 2007-12-27 17:13:44 UTC (rev 1491)
@@ -48,7 +48,7 @@
rval = this->refine_1_simplex( 0, &entity_coords[0], 0, &entity_coords[6], 0 ); // FIXME
break;
case MBTRI:
- rval = this->refine_2_simplex();
+ rval = this->refine_2_simplex( 0 , 0, 0, 0, 0, 0, 0 ); // FIXME
break;
case MBQUAD:
std::cerr << "Quadrilaterals not handled yet\n";
@@ -109,7 +109,7 @@
* in space and vertices as degrees-of-freedom in a mesh (i.e. a vertex that is
* treated as a lumped-parameter model).
*/
-void MBSimplexTemplateRefiner::refine_0_simplex( double* v0, const void* t0 )
+void MBSimplexTemplateRefiner::refine_0_simplex( const double* v0, const void* t0 )
{
(*this->output_functor)( v0, t0 );
(*this->output_functor)( MBVERTEX );
@@ -117,7 +117,8 @@
/**\brief Refine an edge.
*/
-bool MBSimplexTemplateRefiner::refine_1_simplex( int max_depth, double* v0, void* t0, double* v1, void* t1 )
+bool MBSimplexTemplateRefiner::refine_1_simplex(
+ int max_depth, const double* v0, const void* t0, const double* v1, const void* t1 )
{
bool edge_code = false;
@@ -134,7 +135,7 @@
for ( i = 0; i < 6; i++ )
midptc[i] = ( v0[i] + v1[i] ) / 2.;
- this->evaluate_tags_at_midpoint( v0, t0, midptc, midptt, v1, t1 );
+ this->edge_size_evaluator->evaluate_tags_at_midpoint( v0, t0, midptc, midptt, v1, t1 );
edge_code = this->edge_size_evaluator->evaluate_edge( v0, t0, midptc, midptt, v1, t1 );
}
@@ -159,8 +160,27 @@
/**\brief Refine a triangle.
*/
-bool MBSimplexTemplateRefiner::refine_2_simplex()
+bool MBSimplexTemplateRefiner::refine_2_simplex(
+ int max_depth, const double* v0, const void* t0, const double* v1, const void* t1, const double* v2, const void* t2 )
{
+ int edgeCode = 0;
+
+ double* midpt0c;
+ double* midpt1c;
+ double* midpt2c;
+ void* midpt0t;
+ void* midpt1t;
+ void* midpt2t;
+
+ if ( max_depth-- > 0 )
+ {
+ int i;
+ for ( i = 0; i < 3; ++i )
+ {
+
+ }
+ }
+
return true;
}
Modified: MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp
===================================================================
--- MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp 2007-12-27 10:02:36 UTC (rev 1490)
+++ MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp 2007-12-27 17:13:44 UTC (rev 1491)
@@ -44,9 +44,11 @@
static int* template_index;
static int* templates;
- void refine_0_simplex( double* v0, const void* t0 );
- bool refine_1_simplex( int max_depth, double* v0, void* t0, double* v1, void* t1 );
- bool refine_2_simplex();
+ void refine_0_simplex( const double* v0, const void* t0 );
+ bool refine_1_simplex( int max_depth,
+ const double* v0, const void* t0, const double* v1, const void* t1 );
+ bool refine_2_simplex( int max_depth,
+ const double* v0, const void* t0, const double* v1, const void* t1, const double* v2, const void* t2 );
bool refine_3_simplex();
};
#endif // MB_SIMPLEXTEMPLATEREFINER_H
More information about the moab-dev
mailing list