[MOAB-dev] commit/MOAB: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jan 9 23:17:46 CST 2014
2 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/49d9a92f6e98/
Changeset: 49d9a92f6e98
Branch: None
User: iulian07
Date: 2014-01-10 06:13:20
Summary: enforce convexity for transport examples
concave departure polygons are decomposed into
convex polygons
the corresponding arrival cell is set for the
decomposition polygons
still need to fix remote_cells tuples
if a decomposed poly is from another proc,
remote cells need to show the arrival
polys for the new cells
Affected #: 4 files
diff --git a/tools/mbcslam/CslamUtils.cpp b/tools/mbcslam/CslamUtils.cpp
index e806d61..c5417c1 100644
--- a/tools/mbcslam/CslamUtils.cpp
+++ b/tools/mbcslam/CslamUtils.cpp
@@ -906,16 +906,26 @@ void velocity_case1(CartVect & arrival_point, double t, CartVect & velo)
//
ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
{
- // look at each quad; compute all 4 angles; if one is reflex, break along that diagonal
+ // look at each polygon; compute all angles; if one is reflex, break that angle with
+ // the next triangle; put the 2 new polys in the set;
+ // still look at the next poly
// replace it with 2 triangles, and remove from set;
// it should work for all polygons / tested first for case 1, with dt 0.5 (too much deformation)
// get all entities of dimension 2
// then get the connectivity, etc
+
Range inputRange;
ErrorCode rval = mb->get_entities_by_dimension(lset, 2, inputRange);
if (MB_SUCCESS != rval)
return rval;
+ Tag corrTag=0;
+ EntityHandle dumH=0;
+ rval = mb->tag_get_handle(CORRTAGNAME,
+ 1, MB_TYPE_HANDLE, corrTag,
+ MB_TAG_DENSE, &dumH);
+ if(rval==MB_TAG_NOT_FOUND)
+ corrTag = 0;
std::vector<double> coords;
coords.resize(3*MAXEDGES); // at most 10 vertices per polygon
// we should create a queue with new polygons that need processing for reflex angles
@@ -942,6 +952,13 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
rval = mb->get_connectivity(eh, verts, num_nodes);
if (MB_SUCCESS != rval)
return rval;
+ EntityHandle corrHandle=0;
+ if (corrTag)
+ {
+ rval = mb->tag_get_data(corrTag, &eh, 1, &corrHandle);
+ if (MB_SUCCESS != rval)
+ return rval;
+ }
coords.resize(3 * num_nodes);
if (num_nodes < 4)
continue; // if already triangles, don't bother
@@ -998,6 +1015,12 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
rval = mb->add_entities(lset, &newElement, 1);
if (MB_SUCCESS != rval)
return rval;
+ if (corrTag)
+ {
+ rval = mb->tag_set_data(corrTag, &newElement, 1, &corrHandle);
+ if (MB_SUCCESS != rval)
+ return rval;
+ }
if (num_nodes == 4)
{
// create another triangle
@@ -1017,6 +1040,12 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
rval = mb->add_entities(lset, &newElement, 1);
if (MB_SUCCESS != rval)
return rval;
+ if (corrTag)
+ {
+ rval = mb->tag_set_data(corrTag, &newElement, 1, &corrHandle);
+ if (MB_SUCCESS != rval)
+ return rval;
+ }
mb->remove_entities(lset, &eh, 1);
brokenPolys++;
/*std::cout<<"remove: " ;
@@ -1029,7 +1058,7 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
}
}
}
- std::cout << "on rank " << my_rank << " " << brokenPolys << " concave polygons were decomposed in convex ones \n";
+ std::cout << "on local process " << my_rank << " " << brokenPolys << " concave polygons were decomposed in convex ones \n";
return MB_SUCCESS;
}
ErrorCode create_span_quads(Interface * mb, EntityHandle euler_set, int rank)
diff --git a/tools/mbcslam/create_dp.cpp b/tools/mbcslam/create_dp.cpp
index bd2459b..43e1735 100644
--- a/tools/mbcslam/create_dp.cpp
+++ b/tools/mbcslam/create_dp.cpp
@@ -185,10 +185,11 @@ int main(int argc, char **argv)
if (argc < 3)
{
- std::cout << " usage: create_dp <input><output> -t <time> -dt <delta_t> -h \n";
+ std::cout << " usage: create_dp <input><output> -t <time> -dt <delta_t> [-skipdp] -f <field> -h \n";
return 1;
}
+ bool skip= false;
double dt=0.1;
double t=0.1; // corresponding to diffusion first step
@@ -208,9 +209,18 @@ int main(int argc, char **argv)
if (!strcmp(argv[index], "-h"))
{
- std::cout << " usage: create_dp <input><output> -t <time> -dt <delta_t> -h \n";
+ std::cout << " usage: create_dp <input><output> -t <time> -dt <delta_t> [-skipdp] -f <field> -h \n";
return 1;
}
+ if (!strcmp(argv[index], "-f")) // delete partition sets
+ {
+ field_type = atoi(argv[++index]);
+ }
+
+ if (!strcmp(argv[index], "-skipdp") )
+ {
+ skip = true;
+ }
index++;
}
@@ -224,43 +234,50 @@ int main(int argc, char **argv)
std::cout << " -t " << t << " -dt " << dt << " input: " << input_mesh1 <<
" output: " << output << "\n";
- Range verts;
- rval = mb.get_entities_by_dimension(0, 0, verts);
- if (MB_SUCCESS != rval)
- return 1;
-
- double *x_ptr, *y_ptr, *z_ptr;
- int count;
- rval = mb.coords_iterate(verts.begin(), verts.end(), x_ptr, y_ptr, z_ptr, count);
- if (MB_SUCCESS != rval)
+ // skip if we need for DP (already existing)
+ if (skip)
+ {
+ std::cout<<" do not add DP tag \n";
+ }
+ else
+ {
+ Range verts;
+ rval = mb.get_entities_by_dimension(0, 0, verts);
+ if (MB_SUCCESS != rval)
return 1;
- assert(count == (int) verts.size()); // should end up with just one contiguous chunk of vertices
- Tag tagh = 0;
- std::string tag_name("DP");
- rval = mb.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE, tagh, MB_TAG_DENSE | MB_TAG_CREAT);
- CHECK_ERR(rval);
- void *data; // pointer to the LOC in memory, for each vertex
- int count_tag;
+ double *x_ptr, *y_ptr, *z_ptr;
+ int count;
+ rval = mb.coords_iterate(verts.begin(), verts.end(), x_ptr, y_ptr, z_ptr, count);
+ if (MB_SUCCESS != rval)
+ return 1;
+ assert(count == (int) verts.size()); // should end up with just one contiguous chunk of vertices
- rval = mb.tag_iterate(tagh, verts.begin(), verts.end(), count_tag, data);
- CHECK_ERR(rval);
- // here we are checking contiguity
- assert(count_tag == (int) verts.size());
- double * ptr_DP=(double*)data;
+ Tag tagh = 0;
+ std::string tag_name("DP");
+ rval = mb.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE, tagh, MB_TAG_DENSE | MB_TAG_CREAT);
+ CHECK_ERR(rval);
+ void *data; // pointer to the LOC in memory, for each vertex
+ int count_tag;
- for (int v = 0; v < count; v++) {
- //EntityHandle v = verts[v];
- CartVect pos( x_ptr[v], y_ptr[v] , z_ptr[v]);
- CartVect newPos;
- departure_point_case1(pos, t, dt, newPos);
- ptr_DP[0]=newPos[0];
- ptr_DP[1]=newPos[1];
- ptr_DP[2]=newPos[2];
- ptr_DP+=3; // increment to the next vertex
+ rval = mb.tag_iterate(tagh, verts.begin(), verts.end(), count_tag, data);
+ CHECK_ERR(rval);
+ // here we are checking contiguity
+ assert(count_tag == (int) verts.size());
+ double * ptr_DP=(double*)data;
+
+ for (int v = 0; v < count; v++) {
+ //EntityHandle v = verts[v];
+ CartVect pos( x_ptr[v], y_ptr[v] , z_ptr[v]);
+ CartVect newPos;
+ departure_point_case1(pos, t, dt, newPos);
+ ptr_DP[0]=newPos[0];
+ ptr_DP[1]=newPos[1];
+ ptr_DP[2]=newPos[2];
+ ptr_DP+=3; // increment to the next vertex
+ }
}
-
rval = add_field_value(mb);
mb.write_file(output);
diff --git a/tools/mbcslam/intx_mpas.cpp b/tools/mbcslam/intx_mpas.cpp
index 570c97f..d737156 100644
--- a/tools/mbcslam/intx_mpas.cpp
+++ b/tools/mbcslam/intx_mpas.cpp
@@ -216,7 +216,7 @@ int main(int argc, char **argv)
if (Verbose)
{
std::stringstream lagrIni;
- lagrIni<<"def0" << rank<<".h5m";
+ lagrIni<<"lagr0" << rank<<".h5m";
rval = mb.write_file(lagrIni.str().c_str(), 0, 0, &covering_lagr_set, 1);
}
@@ -226,7 +226,7 @@ int main(int argc, char **argv)
if (Verbose)
{
std::stringstream ste;
- ste<<"lagr0" << rank<<".h5m";
+ ste<<"euler0" << rank<<".h5m";
rval = mb.write_file(ste.str().c_str(), 0, 0, &euler_set, 1);
}
diff --git a/tools/mbcslam/wrap_intx.cpp b/tools/mbcslam/wrap_intx.cpp
index b973acf..878a832 100644
--- a/tools/mbcslam/wrap_intx.cpp
+++ b/tools/mbcslam/wrap_intx.cpp
@@ -17,7 +17,7 @@
using namespace moab;
double radius = 1.;
double gtol = 1.e-9;
-bool debug = false;
+bool debug = true;
#ifdef __cplusplus
extern "C" {
@@ -52,6 +52,10 @@ void update_tracer( iMesh_Instance instance, iBase_EntitySetHandle imesh_euler_s
ERRORV(rval , "can't write covering set ");
}
+ //
+ rval = enforce_convexity(mb, covering_lagr_set);
+ ERRORV(rval , "can't write covering set ");
+
EntityHandle outputSet;
rval = mb->create_meshset(MESHSET_SET, outputSet);
ERRORV(rval , "can't create output set ");
https://bitbucket.org/fathomteam/moab/commits/1a773dc1d614/
Changeset: 1a773dc1d614
Branch: master
User: iulian07
Date: 2014-01-10 06:16:42
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 0 files
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