MeshObject* construct_mesh_object(int num_vertices, const double *positions, int num_triangles, const int *triangles) { exactinit(); // really only need to call this once, but safe to call always return new MeshObject(num_vertices, positions, num_triangles, triangles); }
void PredWrapper::init( const Point3HVec& pointVec, Point3 ptInfty ) { _pointArr = &pointVec[0]; _pointNum = pointVec.size(); _infIdx = _pointNum; _ptInfty = ptInfty; exactinit(); }
void tetraTests( void ) { exactinit(); /* * It should create a "working" tetrahedron out of * a set of points * */ const Real edge_length = 9; const Point<Real> a{ 0, 0, 0 }; const Point<Real> b{ 0, edge_length, 0 }; const Point<Real> c{ edge_length, 0, 0 }; const Point<Real> d{ 0, 0, edge_length }; Tetra t{ &a, &b, &c, &d }; assert( t.orientation() == Orientation::Positive ); /* * We should also be able to derive location codes * from a tetrahedron. In fact, we should be able * to derive a location code for the following : * 6 edges, 4 faces, inside tetrahedron and outside * */ const int factor = 2; const Real m_el = edge_length / factor; const Point<Real> e10 = { 0, m_el, 0 }; const Point<Real> e20 = { m_el, 0, 0 }; const Point<Real> e30 = { 0, 0, m_el }; const Point<Real> e21 = { m_el, m_el, 0 }; const Point<Real> e31 = { 0, m_el, m_el }; const Point<Real> e32 = { m_el, 0, m_el }; const Point<Real> f321 = ( ( d - a ) + ( c - a ) + ( b - a ) ) / 3; const Point<Real> f023 = ( ( c - a ) + ( d - a ) ) / 3; const Point<Real> f031 = ( ( d - a ) + ( b - a ) ) / 3; const Point<Real> f012 = ( ( b - a ) + ( c - a ) ) / 3; const Point<Real> inside = ( ( b - a ) + ( c - a ) + ( d - a ) ) / 4; // all 6 edges assert( t.locationCode( e10 ) == 1 + 2 ); assert( t.locationCode( e20 ) == 1 + 4 ); assert( t.locationCode( e30 ) == 1 + 8 ); assert( t.locationCode( e21 ) == 2 + 4 ); assert( t.locationCode( e31 ) == 2 + 8 ); assert( t.locationCode( e32 ) == 4 + 8 ); // all 4 faces assert( t.locationCode( f321 ) == 2 + 4 + 8 ); assert( t.locationCode( f023 ) == 1 + 4 + 8 ); assert( t.locationCode( f031 ) == 1 + 2 + 8 ); assert( t.locationCode( f012 ) == 1 + 2 + 4 ); // inside the tetrahedron assert( t.locationCode( inside ) == 1 + 2 + 4 + 8 ); // all 4 vertices assert( t.locationCode( a ) == 1 ); assert( t.locationCode( b ) == 2 ); assert( t.locationCode( c ) == 4 ); assert( t.locationCode( d ) == 8 ); }