moab-dev
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
July 2014
- 13 participants
- 72 discussions
commit/MOAB: iulian07: skip merge if not needed and skip PCOMM if on one proc
by commits-noreply@bitbucket.org 10 Jul '14
by commits-noreply@bitbucket.org 10 Jul '14
10 Jul '14
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/852870526329/
Changeset: 852870526329
Branch: iulian07/largemesh
User: iulian07
Date: 2014-07-11 03:27:16
Summary: skip merge if not needed and skip PCOMM if on one proc
will be able to create meshes faster, if the partitioning
is not needed
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 4ec1e1b..4338601 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -493,55 +493,58 @@ int main(int argc, char **argv)
rval = mb->get_entities_by_dimension(0, 0, verts);
CHECKE("Can't get all vertices.");
-
- if (newMergeMethod)
- rval = mm.merge_using_integer_tag( verts, global_id_tag);
- else
- rval = mm.merge_entities(all3dcells, 0.0001);
- CHECKE("Can't merge");
- if (0==rank)
+ if (A*B*C!=1) // merge needed
{
- std::cout << "merge locally: "
- << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
- tt = clock();
+ if (newMergeMethod)
+ rval = mm.merge_using_integer_tag( verts, global_id_tag);
+ else
+ rval = mm.merge_entities(all3dcells, 0.0001);
+ CHECKE("Can't merge");
+ if (0==rank)
+ {
+ std::cout << "merge locally: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
}
-
- ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
- if (pcomm==NULL)
+ if (size>1)
{
- pcomm = new ParallelComm( mb, MPI_COMM_WORLD );
- }
- rval = pcomm->resolve_shared_ents( 0, all3dcells, 3, 0 );
- CHECKE("Can't resolve shared ents");
+ ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
+ if (pcomm==NULL)
+ {
+ pcomm = new ParallelComm( mb, MPI_COMM_WORLD );
+ }
+ rval = pcomm->resolve_shared_ents( 0, all3dcells, 3, 0 );
+ CHECKE("Can't resolve shared ents");
- if (0==rank)
- {
- std::cout << "resolve shared entities: "
- << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
- tt = clock();
- }
+ if (0==rank)
+ {
+ std::cout << "resolve shared entities: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
- if (!keep_skins) // default is to delete the 1- and 2-dimensional entities
- {
- // delete all quads and edges
- Range toDelete;
- rval = mb->get_entities_by_dimension(0, 1, toDelete);
- CHECKE("Can't get edges");
+ if (!keep_skins) // default is to delete the 1- and 2-dimensional entities
+ {
+ // delete all quads and edges
+ Range toDelete;
+ rval = mb->get_entities_by_dimension(0, 1, toDelete);
+ CHECKE("Can't get edges");
- rval = mb->get_entities_by_dimension(0, 2, toDelete);
- CHECKE("Can't get faces");
+ rval = mb->get_entities_by_dimension(0, 2, toDelete);
+ CHECKE("Can't get faces");
- rval = pcomm->delete_entities(toDelete) ;
- CHECKE("Can't delete entities")
+ rval = pcomm->delete_entities(toDelete) ;
+ CHECKE("Can't delete entities")
- if (0==rank)
- {
- std::cout << "delete edges and faces, and correct sharedEnts: "
- << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
- tt = clock();
+ if (0==rank)
+ {
+ std::cout << "delete edges and faces, and correct sharedEnts: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
}
}
-
rval = mb->write_file(outFileName.c_str(), 0, ";;PARALLEL=WRITE_PART");
CHECKE("Can't write in parallel");
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.
1
0
commit/MOAB: nray: Added down adjacencies. Merged separate performance tests for AHF and
by commits-noreply@bitbucket.org 10 Jul '14
by commits-noreply@bitbucket.org 10 Jul '14
10 Jul '14
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/2ef61db922a7/
Changeset: 2ef61db922a7
Branch: nray/feature_ahf
User: nray
Date: 2014-07-11 01:39:34
Summary: Added down adjacencies. Merged separate performance tests for AHF and
MOAB adjacencies into one. Some optimization.
Affected #: 11 files
diff --git a/src/Core.cpp b/src/Core.cpp
index 9bfb9ca..e8cdf33 100644
--- a/src/Core.cpp
+++ b/src/Core.cpp
@@ -1542,11 +1542,8 @@ ErrorCode Core::get_adjacencies( const EntityHandle *from_entities,
#ifdef USE_AHF
bool can_handle = true;
- int source_dim = this->dimension_from_handle(from_entities[0]);
- if ((source_dim > to_dimension) && (to_dimension != 0))
- can_handle = false; //NOT SUPPORTED: Down adjacencies
- else if (to_dimension == 4)
+ if (to_dimension == 4)
can_handle = false; // NOT SUPPORTED: meshsets
else if (create_if_missing)
can_handle = false;//NOT SUPPORTED: create_if_missing
@@ -1555,7 +1552,7 @@ ErrorCode Core::get_adjacencies( const EntityHandle *from_entities,
if (mixed)
can_handle = false;
- if (mesh_modified)
+ if (mesh_modified) //NOT SUPPORTED: modified mesh
can_handle = false;
if (can_handle)
diff --git a/src/HalfFacetRep.cpp b/src/HalfFacetRep.cpp
index fbda680..4e363e3 100755
--- a/src/HalfFacetRep.cpp
+++ b/src/HalfFacetRep.cpp
@@ -27,8 +27,6 @@
namespace moab {
- const int MAXSIZE = 150;
-
HalfFacetRep::HalfFacetRep(Core *impl)
{
assert(NULL != impl);
@@ -73,19 +71,19 @@ namespace moab {
{{{0,0,1,0},{0,0,0,0},{1,0,1,0},{0,0,0,0}}},
//SURFACE_MIXED
- {{{0,1,1,0},{1,1,1,0},{1,0,1,0},{0,0,0,0}}},
+ {{{0,1,1,0},{1,1,1,0},{1,1,1,0},{0,0,0,0}}},
//VOLUME
{{{0,0,0,1},{0,0,0,0},{0,0,0,0},{1,0,0,1}}},
//VOLUME_MIXED_1
- {{{0,1,0,1},{1,1,0,1},{0,0,0,0},{1,0,0,1}}},
+ {{{0,1,0,1},{1,1,0,1},{0,0,0,0},{1,1,0,1}}},
//VOLUME_MIXED_2
- {{{0,0,1,1},{0,0,0,0},{1,0,1,1},{1,0,0,1}}},
+ {{{0,0,1,1},{0,0,0,0},{1,0,1,1},{1,0,1,1}}},
//VOLUME_MIXED
- {{{0,1,1,1},{1,1,1,1},{1,0,1,1},{1,0,0,1}}}
+ {{{0,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}}
};
int HalfFacetRep::get_index_for_meshtype(MESHTYPE mesh_type)
@@ -278,6 +276,17 @@ namespace moab {
error = determine_incident_halfedges(_faces);
if (MB_SUCCESS != error) return error;
+ //Create face tags
+ error = mb->tag_get_handle("__VISITED_FACE", 1, MB_TYPE_INTEGER, visited_face, MB_TAG_DENSE | MB_TAG_CREAT, &ival);
+ if (MB_SUCCESS != error) return error;
+
+ //Initialize queues for storing face and local id's during local search
+ for (int i = 0; i< MAXSIZE; i++)
+ {
+ queue_fid[i] = 0;
+ queue_lid[i] = 0;
+ }
+
delete [] sdefval;
delete [] sval;
@@ -299,6 +308,7 @@ namespace moab {
sval[i] = 0;
}
+ //Create tags to store ahf maps for volume
error = mb->tag_get_handle("__SIBHFS_CID", nfpc, MB_TYPE_HANDLE, sibhfs_cid, MB_TAG_DENSE | MB_TAG_CREAT, sdefval);
if (MB_SUCCESS != error) return error;
error = mb->tag_get_handle("__SIBHFS_LFID", nfpc, MB_TYPE_INTEGER, sibhfs_lfid, MB_TAG_DENSE | MB_TAG_CREAT, sval);
@@ -308,11 +318,17 @@ namespace moab {
error = mb->tag_get_handle("__V2HF_LFID", 1, MB_TYPE_INTEGER, v2hf_lfid, MB_TAG_DENSE | MB_TAG_CREAT, &ival);
if (MB_SUCCESS != error) return error;
+ //Construct the maps
error = determine_sibling_halffaces(_cells);
if (MB_SUCCESS != error) return error;
error = determine_incident_halffaces(_cells);
if (MB_SUCCESS != error) return error;
+
+ //Create cell tag
+ error = mb->tag_get_handle("__VISITED_CELL", 1, MB_TYPE_INTEGER, visited_cell, MB_TAG_DENSE | MB_TAG_CREAT, &ival);
+ if (MB_SUCCESS != error) return error;
+
delete [] sdefval;
delete [] sval;
@@ -393,6 +409,9 @@ namespace moab {
error = mb->tag_delete(v2he_leid);
if (MB_SUCCESS != error) return error;
+ error = mb->tag_delete(visited_face);
+ if (MB_SUCCESS != error) return error;
+
return MB_SUCCESS;
}
@@ -407,6 +426,10 @@ namespace moab {
error = mb->tag_delete(v2hf_lfid);
if (MB_SUCCESS != error) return error;
+ error = mb->tag_delete(visited_cell);
+ if (MB_SUCCESS != error) return error;
+
+
return MB_SUCCESS;
}
@@ -550,64 +573,20 @@ namespace moab {
if (adj_possible)
{
-
- if (source_dimension == 0) // Vertex to up adjacencies
- {
- if (target_dimension == 1)
- {
- error = get_up_adjacencies_1d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
- else if (target_dimension == 2)
- {
- error = get_up_adjacencies_vert_2d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
- else if (target_dimension == 3)
- {
- error = get_up_adjacencies_vert_3d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
- }
-
- else if (source_dimension == 1) // Edge to up adjacencies
+ if (source_dimension < target_dimension)
{
- if (target_dimension == 2)
- {
- error = get_up_adjacencies_2d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
- else if (target_dimension == 3)
- {
- error = get_up_adjacencies_edg_3d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
+ error = get_up_adjacencies(source_entity, target_dimension, target_entities);
+ if (MB_SUCCESS != error) return error;
}
-
- else if ((source_dimension == 2) && (target_dimension ==3)) // Face to up adjacencies
+ else if (source_dimension == target_dimension)
{
- error = get_up_adjacencies_face_3d(source_entity, target_entities);
+ error = get_neighbor_adjacencies(source_entity, target_entities);
if (MB_SUCCESS != error) return error;
}
-
- else if (source_dimension == target_dimension) // Same dimensional adjacencies
+ else
{
- if (target_dimension == 1)
- {
- error = get_neighbor_adjacencies_1d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
-
- else if (target_dimension == 2)
- {
- error = get_neighbor_adjacencies_2d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
- else if (target_dimension == 3)
- {
- error = get_neighbor_adjacencies_3d(source_entity, target_entities);
- if (MB_SUCCESS != error) return error;
- }
+ error = get_down_adjacencies(source_entity, target_dimension, target_entities);
+ if (MB_SUCCESS != error) return error;
}
}
else
@@ -688,6 +667,28 @@ namespace moab {
return MB_SUCCESS;
}
+ ErrorCode HalfFacetRep::get_down_adjacencies(EntityHandle ent, int out_dim, std::vector<EntityHandle> &adjents)
+ {
+ ErrorCode error;
+ int in_dim = mb->dimension_from_handle(ent);
+ if ((in_dim == 2)&&(out_dim == 1))
+ {
+ error = get_down_adjacencies_2d(ent, adjents);
+ if (MB_SUCCESS != error) return error;
+ }
+ else if ((in_dim == 3)&&(out_dim == 1))
+ {
+ error = get_down_adjacencies_edg_3d(ent, adjents);
+ if (MB_SUCCESS != error) return error;
+ }
+ else if ((in_dim == 3)&&(out_dim == 2))
+ {
+ error = get_down_adjacencies_face_3d(ent, adjents);
+ if (MB_SUCCESS != error) return error;
+ }
+ return MB_SUCCESS;
+ }
+
/********************************************************
* 1D: sibhvs, v2hv, incident and neighborhood queries *
*********************************************************/
@@ -1203,17 +1204,9 @@ namespace moab {
{
adjents.push_back(fid);
- EntityHandle queue_fid[MAXSIZE], trackfaces[MAXSIZE];
- int queue_lid[MAXSIZE];
- for (int i = 0; i< MAXSIZE; i++)
- {
- queue_fid[i] = 0;
- queue_lid[i] = 0;
- trackfaces[i] = 0;
- }
- int qsize = 0, count = -1;
+ int qsize = 0;
int num_qvals = 0;
- error = gather_halfedges(vid, fid, lid, queue_fid, queue_lid, &qsize, trackfaces, &count);
+ error = gather_halfedges(vid, fid, lid, &qsize);
if (MB_SUCCESS != error) return error;
while (num_qvals < qsize)
@@ -1226,20 +1219,35 @@ namespace moab {
error = another_halfedge(vid, curfid, curlid, &he2_fid, &he2_lid);
if (MB_SUCCESS != error) return error;
- bool found_ent = find_match_in_array(he2_fid, trackfaces, count);
+ int val;
+ error = mb->tag_get_data(visited_face, &he2_fid, 1, &val);
+ if (MB_SUCCESS != error) return error;
- if (found_ent)
+ if (val)
continue;
- count += 1;
- trackfaces[count] = he2_fid;
- error = get_up_adjacencies_2d(he2_fid, he2_lid, queue_fid, queue_lid, &qsize, trackfaces, &count);
+ val = 1;
+ error = mb->tag_set_data(visited_face, &he2_fid, 1, &val);
if (MB_SUCCESS != error) return error;
- adjents.push_back(he2_fid);
+ error = get_up_adjacencies_2d(he2_fid, he2_lid, &qsize);
+ if (MB_SUCCESS != error) return error;
+ adjents.push_back(he2_fid);
}
- }
+
+ //Change the visited faces to false, also empty the queue
+ for (int i = 0; i<qsize; i++)
+ {
+ int val = 0;
+ error = mb->tag_set_data(visited_face, &queue_fid[i], 1, &val);
+ if (MB_SUCCESS != error) return error;
+
+ queue_fid[i] = 0;
+ queue_lid[i] = 0;
+ }
+
+ }
return MB_SUCCESS;
}
@@ -1251,7 +1259,6 @@ namespace moab {
{
// Given an explicit edge eid, find the incident faces.
-
ErrorCode error;
EntityHandle he_fid=0; int he_lid=0;
@@ -1322,11 +1329,8 @@ namespace moab {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ErrorCode HalfFacetRep::get_up_adjacencies_2d(EntityHandle fid,
int lid,
- EntityHandle *queue_fid,
- int *queue_lid,
- int *qsize,
- EntityHandle *trackfaces,
- int *tcount)
+ int *qsize
+ )
{
ErrorCode error;
@@ -1345,7 +1349,6 @@ namespace moab {
int index = 0;
bool found_ent = find_match_in_array(fid, queue_fid, qsize[0]-1, true, &index);
if ((!found_ent)||((found_ent) && (queue_lid[index] != lid)))
-
{
queue_fid[qsize[0]] = fid;
queue_lid[qsize[0]] = lid;
@@ -1354,14 +1357,14 @@ namespace moab {
}
while ((curfid != fid)&&(curfid != 0)) {
+ int val;
+ error = mb->tag_get_data(visited_face, &curfid, 1, &val);
+ if (MB_SUCCESS != error) return error;
- bool found = find_match_in_array(curfid, trackfaces, tcount[0]);
-
- if (!found){
+ if (!val){
queue_fid[qsize[0]] = curfid;
queue_lid[qsize[0]] = curlid;
qsize[0] += 1;
-
}
sib_fids.clear();
@@ -1396,22 +1399,26 @@ namespace moab {
bool found = false;
if (fid!=0){
- EntityHandle queue_fid[MAXSIZE], trackfaces[MAXSIZE];
- int queue_lid[MAXSIZE];
- for (int i = 0; i< MAXSIZE; i++)
- {
- queue_fid[i] = 0;
- queue_lid[i] = 0;
- trackfaces[i] = 0;
- }
- int qsize = 0, tcount = -1;
+
+ int qsize = 0;
EntityHandle vid = conn[0];
- error = gather_halfedges(vid, fid, lid, queue_fid, queue_lid, &qsize, trackfaces, &tcount);
+ error = gather_halfedges(vid, fid, lid, &qsize);
if (MB_SUCCESS != error) return error;
- found = collect_and_compare(conn, queue_fid, queue_lid, &qsize, trackfaces, &tcount, hefid, helid);
+ found = collect_and_compare(conn, &qsize, hefid, helid);
+
+ //Change the visited faces to false
+ for (int i = 0; i<qsize; i++)
+ {
+ int val = 0;
+ error = mb->tag_set_data(visited_face, &queue_fid[i], 1, &val);
+ if (MB_SUCCESS != error) return error;
+
+ queue_fid[i] = 0;
+ queue_lid[i] = 0;
+ }
}
return found;
@@ -1420,11 +1427,8 @@ namespace moab {
ErrorCode HalfFacetRep::gather_halfedges( EntityHandle vid,
EntityHandle he_fid,
int he_lid,
- EntityHandle *queue_fid,
- int *queue_lid,
- int *qsize,
- EntityHandle *trackfaces,
- int *tcount)
+ int *qsize
+ )
{
ErrorCode error;
EntityHandle he2_fid = 0; int he2_lid = 0;
@@ -1436,12 +1440,14 @@ namespace moab {
*qsize += 1;
queue_fid[*qsize] = he2_fid; queue_lid[*qsize] = he2_lid;
*qsize += 1;
- tcount[0] += 1;
- trackfaces[tcount[0]] = he_fid;
+
+ int val = 1;
+ error = mb->tag_set_data(visited_face, &he_fid, 1, &val);
+ if (MB_SUCCESS != error) return error;
- error = get_up_adjacencies_2d(he_fid, he_lid, queue_fid, queue_lid, qsize, trackfaces, tcount);
+ error = get_up_adjacencies_2d(he_fid, he_lid, qsize);
if (MB_SUCCESS != error) return error;
- error = get_up_adjacencies_2d(he2_fid, he2_lid, queue_fid, queue_lid, qsize, trackfaces, tcount);
+ error = get_up_adjacencies_2d(he2_fid, he2_lid, qsize);
if (MB_SUCCESS != error) return error;
return MB_SUCCESS;
@@ -1479,11 +1485,7 @@ namespace moab {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HalfFacetRep::collect_and_compare(std::vector<EntityHandle> &edg_vert,
- EntityHandle *queue_fid,
- int *queue_lid,
- int *qsize,
- EntityHandle *trackfaces,
- int *tcount,
+ int *qsize,
EntityHandle *he_fid,
int *he_lid)
{
@@ -1503,41 +1505,45 @@ namespace moab {
int curlid = queue_lid[num_qvals];
num_qvals += 1;
- std::vector<EntityHandle> conn(nepf);
- error = mb->get_connectivity(&curfid, 1, conn);
- if (MB_SUCCESS != error) return error;
+ std::vector<EntityHandle> conn(nepf);
+ error = mb->get_connectivity(&curfid, 1, conn);
+ if (MB_SUCCESS != error) return error;
- int id = next[curlid];
- if (((conn[curlid]==edg_vert[0])&&(conn[id]==edg_vert[1]))||((conn[curlid]==edg_vert[1])&&(conn[id]==edg_vert[0]))){
- *he_fid = curfid;
- *he_lid = curlid;
- found = true;
- break;
- }
+ int id = next[curlid];
+ if (((conn[curlid]==edg_vert[0])&&(conn[id]==edg_vert[1]))||((conn[curlid]==edg_vert[1])&&(conn[id]==edg_vert[0]))){
+ *he_fid = curfid;
+ *he_lid = curlid;
+ found = true;
+ break;
+ }
- bool found_ent = find_match_in_array(curfid, trackfaces, tcount[0]);
+ int val;
+ error = mb->tag_get_data(visited_face, &curfid, 1, &val);
+ if (MB_SUCCESS != error) return error;
- if (found_ent)
- continue;
- tcount[0] += 1;
- trackfaces[tcount[0]] = curfid;
+ if (val)
+ continue;
- EntityHandle he2_fid; int he2_lid;
- error = another_halfedge(edg_vert[0], curfid, curlid, &he2_fid, &he2_lid);
+ val=1;
+ error = mb->tag_set_data(visited_face, &curfid, 1, &val);
+ if (MB_SUCCESS != error) return error;
- if (MB_SUCCESS != error) return error;
- error = get_up_adjacencies_2d(he2_fid, he2_lid, queue_fid, queue_lid, qsize, trackfaces, tcount);
- if (MB_SUCCESS != error) return error;
+ EntityHandle he2_fid; int he2_lid;
+ error = another_halfedge(edg_vert[0], curfid, curlid, &he2_fid, &he2_lid);
+
+ if (MB_SUCCESS != error) return error;
+ error = get_up_adjacencies_2d(he2_fid, he2_lid, qsize);
+ if (MB_SUCCESS != error) return error;
+
+ counter += 1;
+ }
- counter += 1;
- }
-
delete [] next;
delete [] prev;
return found;
}
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
ErrorCode HalfFacetRep::get_neighbor_adjacencies_2d( EntityHandle fid,
std::vector<EntityHandle> &adjents)
{
@@ -1554,6 +1560,50 @@ namespace moab {
return MB_SUCCESS;
}
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ ErrorCode HalfFacetRep::get_down_adjacencies_2d(EntityHandle fid, std::vector<EntityHandle> &adjents)
+ {
+ //Returns explicit edges, if any, of the face
+ ErrorCode error;
+ int nepf = local_maps_2d(fid);
+ std::vector<EntityHandle> conn(nepf);
+ error = mb->get_connectivity(&fid, 1, conn);
+ if (error != MB_SUCCESS) return error;
+
+ //Gather all the incident edges on each vertex of the face
+ std::vector< std::vector<EntityHandle> > temp(nepf);
+ for (int i=0; i<nepf; i++)
+ {
+ error = get_up_adjacencies_1d(conn[i], temp[i]);
+ if (error != MB_SUCCESS) return error;
+ std::sort(temp[i].begin(), temp[i].end());
+ }
+
+ //Loop over all the local edges and find the intersection.
+ for (int i = 0; i < nepf; ++i)
+ {
+ std::vector<EntityHandle> common(10);
+ std::vector<EntityHandle>::iterator it;
+ if (i == nepf-1){
+ it = std::set_intersection(temp[i].begin(), temp[i].end(), temp[0].begin(), temp[0].end(), common.begin());
+ if (*common.begin() == 0)
+ continue;
+
+ adjents.push_back(*common.begin());
+ }
+ else
+ {
+ it = std::set_intersection(temp[i].begin(), temp[i].end(), temp[i+1].begin(), temp[i+1].end(), common.begin());
+ if (*common.begin() == 0)
+ continue;
+
+ adjents.push_back(*common.begin());
+ }
+ }
+ return MB_SUCCESS;
+ }
+
////////////////////////////////////////////////////////////////////////////////////////////////
int HalfFacetRep::find_total_edges_2d(Range &faces)
{
@@ -2087,15 +2137,15 @@ namespace moab {
{
idx = lConnMap3D[index].hf2v[lfid][j];
if (vert0 == sib_conn[idx])
- lv0 = idx;
- if (vert1 == sib_conn[idx])
- lv1 = idx;
- }
+ lv0 = idx;
+ if (vert1 == sib_conn[idx])
+ lv1 = idx;
+ }
- assert((lv0 >= 0) && (lv1 >= 0));
- cur_leid = lConnMap3D[index].lookup_leids[lv0][lv1];
+ assert((lv0 >= 0) && (lv1 >= 0));
+ cur_leid = lConnMap3D[index].lookup_leids[lv0][lv1];
- int chk_lfid = lConnMap3D[index].e2hf[cur_leid][0];
+ int chk_lfid = lConnMap3D[index].e2hf[cur_leid][0];
if (lfid == chk_lfid)
lface = 1;
@@ -2414,6 +2464,96 @@ namespace moab {
return MB_SUCCESS;
}
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ ErrorCode HalfFacetRep::get_down_adjacencies_edg_3d(EntityHandle cid, std::vector<EntityHandle> &adjents)
+ {
+ //Returns explicit edges, if any, of the face
+ ErrorCode error;
+ int index = get_index_from_type(cid);
+ int nvpc = lConnMap3D[index].num_verts_in_cell;
+ int nepc = lConnMap3D[index].num_edges_in_cell;
+
+ std::vector<EntityHandle> conn(nvpc);
+ error = mb->get_connectivity(&cid, 1, conn);
+ if (error != MB_SUCCESS) return error;
+
+ //Gather all the incident edges on each vertex of the face
+ std::vector< std::vector<EntityHandle> > temp(nvpc);
+ for (int i=0; i<nvpc; i++)
+ {
+ error = get_up_adjacencies_1d(conn[i], temp[i]);
+ if (error != MB_SUCCESS) return error;
+ std::sort(temp[i].begin(), temp[i].end());
+ }
+
+ //Loop over all the local edges and find the intersection.
+ for (int i = 0; i < nepc; ++i)
+ {
+ std::vector<EntityHandle> common(10);
+ std::vector<EntityHandle>::iterator it;
+
+ int lv0 = lConnMap3D[index].e2v[i][0];
+ int lv1 = lConnMap3D[index].e2v[i][1];
+
+ it = std::set_intersection(temp[lv0].begin(), temp[lv0].end(), temp[lv1].begin(), temp[lv1].end(), common.begin());
+ if (*common.begin() == 0)
+ continue;
+
+ adjents.push_back(*common.begin());
+ }
+ return MB_SUCCESS;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ ErrorCode HalfFacetRep::get_down_adjacencies_face_3d(EntityHandle cid, std::vector<EntityHandle> &adjents)
+ {
+ //Returns explicit edges, if any, of the face
+ ErrorCode error;
+ int index = get_index_from_type(cid);
+ int nvpc = lConnMap3D[index].num_verts_in_cell;
+ int nfpc = lConnMap3D[index].num_faces_in_cell;
+
+ std::vector<EntityHandle> conn(nvpc);
+ error = mb->get_connectivity(&cid, 1, conn);
+ if (error != MB_SUCCESS) return error;
+
+ //Gather all the incident edges on each vertex of the face
+ std::vector< std::vector<EntityHandle> > temp(nvpc);
+ for (int i=0; i<nvpc; i++)
+ {
+ error = get_up_adjacencies_vert_2d(conn[i], temp[i]);
+ if (error != MB_SUCCESS) return error;
+ std::sort(temp[i].begin(), temp[i].end());
+ }
+
+ //Loop over all the local faces and find the intersection.
+ for (int i = 0; i < nfpc; ++i)
+ {
+ std::vector<EntityHandle> results(100);
+ std::vector<EntityHandle>::iterator it;
+
+ int nvF = lConnMap3D[index].hf2v_num[i];
+
+ int lv0 = lConnMap3D[index].hf2v[i][0];
+ int lv1 = lConnMap3D[index].hf2v[i][1];
+ std::set_intersection(temp[lv0].begin(), temp[lv0].end(), temp[lv1].begin(), temp[lv1].end(), std::back_inserter(results));
+
+ std::vector<EntityHandle> common(100);
+ for (int k = 2; k < nvF; k++){
+ common.clear();
+ int lv = lConnMap3D[index].hf2v[i][k];
+ std::set_intersection(temp[lv].begin(), temp[lv].end(), results.begin(), results.end(), std::back_inserter(common));
+ }
+
+ if (*common.begin() == 0)
+ continue;
+
+ adjents.push_back(*common.begin());
+ }
+ return MB_SUCCESS;
+ }
+
+
///////////////////////////////////////////////////////////////////////////////////////////
bool HalfFacetRep::find_match_in_array(EntityHandle ent, EntityHandle *ent_list, int count, bool get_index, int *index)
{
diff --git a/src/moab/HalfFacetRep.hpp b/src/moab/HalfFacetRep.hpp
index a228520..c960330 100755
--- a/src/moab/HalfFacetRep.hpp
+++ b/src/moab/HalfFacetRep.hpp
@@ -41,22 +41,24 @@ namespace moab {
* \
*/
- //! ENUM for the type of input mesh.
- enum MESHTYPE{
- CURVE = 0, //Homogeneous curve mesh
- SURFACE, // Homogeneous surface mesh
- SURFACE_MIXED, // Mixed surface with embedded curves
- VOLUME, // Homogeneous volume mesh
- VOLUME_MIXED_1, // Volume mesh with embedded curves
- VOLUME_MIXED_2, // Volume mesh with embedded surface
- VOLUME_MIXED //Volume mesh with embedded curves and surfaces
- };
+const int MAXSIZE = 150;
- class Core;
+//! ENUM for the type of input mesh.
+enum MESHTYPE{
+ CURVE = 0, //Homogeneous curve mesh
+ SURFACE, // Homogeneous surface mesh
+ SURFACE_MIXED, // Mixed surface with embedded curves
+ VOLUME, // Homogeneous volume mesh
+ VOLUME_MIXED_1, // Volume mesh with embedded curves
+ VOLUME_MIXED_2, // Volume mesh with embedded surface
+ VOLUME_MIXED //Volume mesh with embedded curves and surfaces
+};
- class HalfFacetRep{
-
- public:
+class Core;
+
+class HalfFacetRep{
+
+public:
HalfFacetRep(Core *impl);
@@ -78,6 +80,7 @@ namespace moab {
ErrorCode print_tags();
+
ErrorCode get_adjacencies(const EntityHandle source_entity,
const unsigned int target_dimension,
std::vector<EntityHandle> &target_entities);
@@ -110,6 +113,9 @@ namespace moab {
ErrorCode get_neighbor_adjacencies(EntityHandle ent,
std::vector<EntityHandle> &adjents);
+ ErrorCode get_down_adjacencies(EntityHandle ent, int out_dim, std::vector<EntityHandle> &adjents);
+
+
// 1D Maps and queries
//! Given a range of edges, determines the map for sibling half-verts and stores them into SIBHVS_EID, SIBHVS_LVID tags.
@@ -224,6 +230,9 @@ namespace moab {
ErrorCode get_neighbor_adjacencies_2d(EntityHandle fid,
std::vector<EntityHandle> &adjents);
+ ErrorCode get_down_adjacencies_2d(EntityHandle fid,
+ std::vector<EntityHandle> &adjents);
+
//! Given a range of faces, finds the total number of edges.
int find_total_edges_2d(Range &faces);
@@ -334,6 +343,11 @@ namespace moab {
ErrorCode get_neighbor_adjacencies_3d(EntityHandle cid,
std::vector<EntityHandle> &adjents);
+
+
+ ErrorCode get_down_adjacencies_edg_3d(EntityHandle cid, std::vector<EntityHandle> &adjents);
+
+ ErrorCode get_down_adjacencies_face_3d(EntityHandle cid, std::vector<EntityHandle> &adjents);
protected:
@@ -356,6 +370,13 @@ namespace moab {
Tag sibhvs_eid, sibhvs_lvid, v2hv_eid, v2hv_lvid;
Tag sibhes_fid, sibhes_leid, v2he_fid, v2he_leid;
Tag sibhfs_cid, sibhfs_lfid, v2hf_cid, v2hf_lfid;
+ Tag visited_face, visited_cell;
+
+ EntityHandle queue_fid[MAXSIZE], trackfaces[MAXSIZE];
+ int queue_lid[MAXSIZE];
+
+
+
MESHTYPE thismeshtype;
MESHTYPE get_mesh_type(int nverts, int nedges, int nfaces, int ncells);
@@ -426,11 +447,7 @@ namespace moab {
ErrorCode get_up_adjacencies_2d(EntityHandle he_fid,
int he_lid,
- EntityHandle *queue_fid,
- int *queue_lid,
- int *qsize,
- EntityHandle *trackfaces,
- int *tcount);
+ int *qsize);
//! Given an edge, finds a matching half-edge in the surface.
/** Given an edge eid, it first collects few half-edges belonging to one-ring neighborhood of
@@ -455,14 +472,10 @@ namespace moab {
* \param trackfaces, tcount
*/
- ErrorCode gather_halfedges( EntityHandle vid,
+ ErrorCode gather_halfedges(EntityHandle vid,
EntityHandle he_fid,
int he_lid,
- EntityHandle *queue_fid,
- int *queue_lid,
- int *qsize,
- EntityHandle *trackfaces,
- int *tcount);
+ int *qsize);
//! Obtains another half-edge belonging to the same face as the input half-edge
/** It uses the local maps to find another half-edge that is either incident or outgoing depending
@@ -490,11 +503,7 @@ namespace moab {
*/
bool collect_and_compare(std::vector<EntityHandle> &edg_vert,
- EntityHandle *queue_fid,
- int *queue_lid,
int *qsize,
- EntityHandle *trackfaces,
- int *tcount,
EntityHandle *he_fid,
int *he_lid);
diff --git a/test/perf/Makefile.am b/test/perf/Makefile.am
index 556554c..1e1da98 100644
--- a/test/perf/Makefile.am
+++ b/test/perf/Makefile.am
@@ -7,7 +7,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/src \
LDADD = $(top_builddir)/src/libMOAB.la
-check_PROGRAMS = perf seqperf adj_time perftool ahf_mem_time adj_without_ahf
+check_PROGRAMS = perf seqperf adj_time perftool adj_mem_time ahf_mem_time
noinst_PROGRAMS =
perf_SOURCES = perf.cpp
@@ -15,7 +15,7 @@ seqperf_SOURCES = seqperf.cpp
adj_time_SOURCES = adj_time.cpp
perftool_SOURCES = perftool.cpp
ahf_mem_time_SOURCES = test_ahf_mem_time.cpp
-adj_without_ahf_SOURCES = adj_without_ahf_mem_time.cpp
+adj_mem_time_SOURCES = adj_mem_time.cpp
if ENABLE_imesh
LDADD += $(top_builddir)/itaps/imesh/libiMesh.la
@@ -25,9 +25,3 @@ if ENABLE_imesh
tstt_perf_binding_SOURCES = tstt_perf_binding.cpp
endif
-if ENABLE_ahf
- check_PROGRAMS += adj_with_ahf
- adj_with_ahf_SOURCES = adj_with_ahf_mem_time.cpp
-endif
-
-
diff --git a/test/perf/adj_mem_time.cpp b/test/perf/adj_mem_time.cpp
new file mode 100755
index 0000000..56b8fb7
--- /dev/null
+++ b/test/perf/adj_mem_time.cpp
@@ -0,0 +1,337 @@
+/*This function tests the AHF datastructures on CST meshes*/
+#include <iostream>
+#include <assert.h>
+#include <time.h>
+#include <vector>
+#include "moab/Core.hpp"
+#include "moab/Range.hpp"
+#include "moab/MeshTopoUtil.hpp"
+#include "moab/HalfFacetRep.hpp"
+#include <sys/time.h>
+
+using namespace moab;
+
+#ifdef MESHDIR
+std::string TestDir(STRINGIFY(MESHDIR));
+#else
+std::string TestDir(".");
+#endif
+
+std::string filename;
+
+double wtime() {
+ double y = -1;
+ struct timeval cur_time;
+ gettimeofday(&cur_time, NULL);
+ y = (double)(cur_time.tv_sec) + (double)(cur_time.tv_usec)*1.e-6;
+ return (y);
+}
+
+int main(int argc, char **argv)
+{
+ // Read the input mesh
+ filename = TestDir + "/hexes_mixed.vtk";
+
+ if (argc==1)
+ std::cout<<"Using default input file:"<<filename<<std::endl;
+ else if (argc==2)
+ filename = argv[1];
+ else {
+ std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl;
+ return 1;
+ }
+
+ ErrorCode error;
+ Core moab;
+ Interface* mbImpl = &moab;
+ MeshTopoUtil mtu(mbImpl);
+
+ error = mbImpl->load_file( filename.c_str());
+ if (MB_SUCCESS != error) {
+ std::cerr << filename <<": failed to load file." << std::endl;
+ return error;
+ }
+
+ //Create ranges for handles of explicit elements of the mixed mesh
+ Range verts, edges, faces, cells;
+ error = mbImpl->get_entities_by_dimension( 0, 0, verts);
+ error = mbImpl->get_entities_by_dimension( 0, 1, edges);
+ error = mbImpl->get_entities_by_dimension( 0, 2, faces);
+ error = mbImpl->get_entities_by_dimension( 0, 3, cells);
+
+ int nverts = verts.size();
+ int nedges = edges.size();
+ int nfaces = faces.size();
+ int ncells = cells.size();
+
+ std::cout<<"nverts = "<<nverts<<", nedges = "<<nedges<<", nfaces = "<<nfaces<<", ncells = "<<ncells<<std::endl;
+
+
+ //Storage Costs before calling ahf functionalities
+ std::cout<<std::endl;
+ std::cout<<"STORAGE BEFORE CALLING ADJACENCIES"<<std::endl;
+ unsigned long sTotS, sTAS, sES, sAES, sAS, sAAS, sTS, sATS;
+ sTotS = sTAS = sES = sAES = sAS = sAAS = sTS = sATS = 0;
+ mbImpl->estimated_memory_use(NULL, 0, &sTotS, &sTAS, &sES, &sAES, &sAS, &sAAS, NULL, 0, &sTS, &sATS);
+ std::cout<<std::endl;
+ std::cout<<"Total storage = "<<sTotS<<std::endl;
+ std::cout<<"Total amortized storage = "<<sTAS<<std::endl;
+ std::cout<<"Entity storage = "<<sES<<std::endl;
+ std::cout<<"Amortized entity storage = "<<sAES<<std::endl;
+ std::cout<<"Adjacency storage = "<<sAS<<std::endl;
+ std::cout<<"Amortized adjacency storage = "<<sAAS<<std::endl;
+ std::cout<<"Tag storage = "<<sTS<<std::endl;
+ std::cout<<"Amortized tag storage = "<<sATS<<std::endl;
+ std::cout<<std::endl;
+
+
+ double time_start, time_avg;
+
+ //Perform queries
+ std::vector<EntityHandle> adjents;
+ Range ngbents;
+
+ // This call should create all the necessary ahf maps or adjacency lists
+ error = mbImpl->get_adjacencies( &*verts.begin(), 1, 1, false, adjents );
+
+ //1D Queries //
+ //IQ1: For every vertex, obtain incident edges
+ std::cout<<"1D QUERIES"<<std::endl;
+ time_start = wtime();
+ for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)verts.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Vertex -> Edges :: MOAB_AHF: Average time = "<< time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Vertex -> Edges :: MOAB: Average time = "<< time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //NQ1: For every edge, obtain neighbor edges
+#ifdef USE_AHF
+ time_start = wtime();
+ for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)edges.size();
+ std::cout<<"QUERY: Edge -> Edges :: MOAB_AHF: Average time = "<<time_avg<<" secs" << std::endl;
+ std::cout<<std::endl;
+#else
+ error = mtu.get_bridge_adjacencies( *edges.begin(), 0, 1, ngbents);
+ time_start = wtime();
+ for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
+ ngbents.clear();
+ error = mtu.get_bridge_adjacencies( *i, 0, 1, ngbents);
+ }
+ time_avg = (wtime()-time_start)/(double)edges.size();
+ std::cout<<"QUERY: Edge -> Edges :: MOAB: Average time = "<<time_avg<<" secs" << std::endl;
+ std::cout<<std::endl;
+#endif
+
+ // 2D Queries
+ std::cout<<"2D QUERIES"<<std::endl;
+ //IQ21: For every vertex, obtain incident faces
+ time_start = wtime();
+ for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)edges.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Vertex -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Vertex -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //IQ22: For every edge, obtain incident faces
+ time_start = wtime();
+ for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)edges.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Edge -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Edge -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //NQ2: For every face, obtain neighbor faces
+#ifdef USE_AHF
+ time_start = wtime();
+ for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)faces.size();
+ std::cout<<"QUERY: Face -> Faces :: MOAB_AHF: Average time = "<< time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ error = mtu.get_bridge_adjacencies( *faces.begin(), 1, 2, ngbents);
+ time_start = wtime();
+ for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
+ ngbents.clear();
+ error = mtu.get_bridge_adjacencies( *i, 1, 2, ngbents);
+ }
+ time_avg = (wtime()-time_start)/(double)faces.size();
+ std::cout<<"QUERY: Face -> Faces :: MOAB: Average time = "<< time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //DQ2: For every face, obtain its edges
+ time_start = wtime();
+ for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)faces.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Face -> Edges :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Face -> Edges :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+
+ // 3D Queries
+ std::cout<<"3D QUERIES"<<std::endl;
+ //IQ31: For every vertex, obtain incident cells
+ time_start = wtime();
+ for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)edges.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Vertex -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Vertex -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ // IQ 32: For every edge, obtain incident cells
+ time_start = wtime();
+ for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)edges.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Edge -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Edge -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
+ std::cout<<std::endl;
+#endif
+
+
+ //IQ32: For every face, obtain incident cells
+ time_start = wtime();
+ for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)faces.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Face -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Face -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //NQ3: For every cell, obtain neighbor cells
+#ifdef USE_AHF
+ time_start = wtime();
+ for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)cells.size();
+ std::cout<<"QUERY: Cell -> Cells :: MOAB_AHF: Average time = "<< time_avg <<" secs" << std::endl;
+ std::cout<<std::endl;
+#else
+ error = mtu.get_bridge_adjacencies( *cells.begin(), 2, 3, ngbents);
+ time_start = wtime();
+ for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
+ ngbents.clear();
+ error = mtu.get_bridge_adjacencies( *i, 2, 3, ngbents);
+ }
+ time_avg = (wtime()-time_start)/(double)cells.size();
+ std::cout<<"QUERY: Cell -> Cells :: MOAB: Average time = "<< time_avg <<" secs" << std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //DQ31: For every cell, obtain its edges
+ time_start = wtime();
+ for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)cells.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Cell -> Edges :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Cell -> Edges :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+ //DQ32: For every cell, obtain its faces
+ time_start = wtime();
+ for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
+ adjents.clear();
+ error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
+ }
+ time_avg = (wtime()-time_start)/(double)cells.size();
+#ifdef USE_AHF
+ std::cout<<"QUERY: Cell -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#else
+ std::cout<<"QUERY: Cell -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
+ std::cout<<std::endl;
+#endif
+
+
+ //Storage Costs after calling ahf deinitialize
+ std::cout<<std::endl;
+ std::cout<<"STORAGE AFTER CALLING ADJACENCIES"<<std::endl;
+ unsigned long eTotS, eTAS, eES, eAES, eAS, eAAS, eTS, eATS;
+ eTotS = eTAS = eES = eAES = eAS = eAAS = eTS = eATS = 0;
+ mbImpl->estimated_memory_use(NULL, 0, &eTotS, &eTAS, &eES, &eAES, &eAS, &eAAS, NULL, 0, &eTS, &eATS);
+ std::cout<<std::endl;
+ std::cout<<"Total storage = "<<eTotS<<std::endl;
+ std::cout<<"Total amortized storage = "<<eTAS<<std::endl;
+ std::cout<<std::endl;
+ std::cout<<"Entity storage = "<<eES<<std::endl;
+ std::cout<<"Amortized entity storage = "<<eAES<<std::endl;
+ std::cout<<std::endl;
+#ifdef USE_AHF
+ std::cout<<"AHF adjacency tag storage = "<<eTS-sTS<<std::endl;
+ std::cout<<"Amortized AHF adjacency tag storage = "<<eATS-sATS<<std::endl;
+ std::cout<<std::endl;
+ std::cout<<"Tag storage = "<<sTS<<std::endl;
+ std::cout<<"Amortized tag storage = "<<sATS<<std::endl;
+#else
+ std::cout<<"Adjacency lists storage = "<<eAS<<std::endl;
+ std::cout<<"Amortized adjacency lists storage = "<<eAAS<<std::endl;
+ std::cout<<std::endl;
+ std::cout<<"Tag storage = "<<eTS<<std::endl;
+ std::cout<<"Amortized tag storage = "<<eATS<<std::endl;
+#endif
+ std::cout<<std::endl;
+
+ return 0;
+}
+
diff --git a/test/perf/adj_with_ahf_mem_time.cpp b/test/perf/adj_with_ahf_mem_time.cpp
deleted file mode 100755
index dbf4558..0000000
--- a/test/perf/adj_with_ahf_mem_time.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*This function tests the AHF datastructures on CST meshes*/
-#include <iostream>
-#include <assert.h>
-#include <time.h>
-#include <vector>
-#include "moab/Core.hpp"
-#include "moab/Range.hpp"
-#include "moab/MeshTopoUtil.hpp"
-#include "moab/HalfFacetRep.hpp"
-#include <sys/time.h>
-
-using namespace moab;
-
-#ifdef MESHDIR
-std::string TestDir(STRINGIFY(MESHDIR));
-#else
-std::string TestDir(".");
-#endif
-
-std::string filename;
-
-double wtime() {
- double y = -1;
- struct timeval cur_time;
- gettimeofday(&cur_time, NULL);
- y = (double)(cur_time.tv_sec) + (double)(cur_time.tv_usec)*1.e-6;
- return (y);
-}
-
-int main(int argc, char **argv)
-{
- // Read the input mesh
- filename = TestDir + "/hexes_mixed.vtk";
-
- if (argc==1)
- std::cout<<"Using default input file:"<<filename<<std::endl;
- else if (argc==2)
- filename = argv[1];
- else {
- std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl;
- return 1;
- }
-
- ErrorCode error;
- Core moab;
- Interface* mbImpl = &moab;
- MeshTopoUtil mtu(mbImpl);
-
- error = mbImpl->load_file( filename.c_str());
- if (MB_SUCCESS != error) {
- std::cerr << filename <<": failed to load file." << std::endl;
- return error;
- }
-
- //Create ranges for handles of explicit elements of the mixed mesh
- Range verts, edges, faces, cells;
- error = mbImpl->get_entities_by_dimension( 0, 0, verts);
- error = mbImpl->get_entities_by_dimension( 0, 1, edges);
- error = mbImpl->get_entities_by_dimension( 0, 2, faces);
- error = mbImpl->get_entities_by_dimension( 0, 3, cells);
-
- int nverts = verts.size();
- int nedges = edges.size();
- int nfaces = faces.size();
- int ncells = cells.size();
-
- std::cout<<"nverts = "<<nverts<<", nedges = "<<nedges<<", nfaces = "<<nfaces<<", ncells = "<<ncells<<std::endl;
-
-
- //Storage Costs before calling ahf functionalities
- std::cout<<std::endl;
- std::cout<<"STORAGE BEFORE CALLING ADJACENCIES"<<std::endl;
- unsigned long sTotS, sTAS, sES, sAES, sAS, sAAS, sTS, sATS;
- sTotS = sTAS = sES = sAES = sAS = sAAS = sTS = sATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &sTotS, &sTAS, &sES, &sAES, &sAS, &sAAS, NULL, 0, &sTS, &sATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<sTotS<<std::endl;
- std::cout<<"Total amortized storage = "<<sTAS<<std::endl;
- std::cout<<"Entity storage = "<<sES<<std::endl;
- std::cout<<"Amortized entity storage = "<<sAES<<std::endl;
- std::cout<<"Adjacency storage = "<<sAS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<sAAS<<std::endl;
- std::cout<<"Tag storage = "<<sTS<<std::endl;
- std::cout<<"Amortized tag storage = "<<sATS<<std::endl;
- std::cout<<std::endl;
-
-
- double time_start, time_avg;
-
- //Perform queries
- std::vector<EntityHandle> adjents;
-
- // This call should create all the necessary ahf maps
- error = mbImpl->get_adjacencies( &*verts.begin(), 1, 1, false, adjents );
-
- //1D Queries //
- //IQ1: For every vertex, obtain incident edges
- std::cout<<"1D QUERIES"<<std::endl;
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)verts.size();
- std::cout<<"QUERY: Vertex -> Edges :: MOAB_AHF: Average time = "<< time_avg<<" secs" <<std::endl;
-
- //NQ1: For every edge, obtain neighbor edges
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Edges :: MOAB_AHF: Average time = "<<time_avg<<" secs" << std::endl;
-
- // 2D Queries
- std::cout<<"2D QUERIES"<<std::endl;
- //IQ21: For every vertex, obtain incident faces
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
-
-
- //IQ22: For every edge, obtain incident faces
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
-
-
- //NQ2: For every face, obtain neighbor faces
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Faces :: MOAB_AHF: Average time = "<< time_avg<<" secs" <<std::endl;
-
-
- // 3D Queries
- std::cout<<"3D QUERIES"<<std::endl;
- //IQ31: For every vertex, obtain incident cells
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
-
-
- // IQ 32: For every edge, obtain incident cells
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
-
-
- //IQ32: For every face, obtain incident cells
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
-
-
- //NQ3: For every cell, obtain neighbor cells
- time_start = wtime();
- for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)cells.size();
- std::cout<<"QUERY: Cell -> Cells :: MOAB_AHF: Average time = "<< time_avg <<" secs" << std::endl;
-
-
- //Storage Costs after calling ahf deinitialize
- std::cout<<std::endl;
- std::cout<<"STORAGE AFTER CALLING ADJACENCIES"<<std::endl;
- unsigned long eTotS, eTAS, eES, eAES, eAS, eAAS, eTS, eATS;
- eTotS = eTAS = eES = eAES = eAS = eAAS = eTS = eATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &eTotS, &eTAS, &eES, &eAES, &eAS, &eAAS, NULL, 0, &eTS, &eATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<eTotS<<std::endl;
- std::cout<<"Total amortized storage = "<<eTAS<<std::endl;
- std::cout<<"Entity storage = "<<eES<<std::endl;
- std::cout<<"Amortized entity storage = "<<eAES<<std::endl;
- std::cout<<"Adjacency storage = "<<eAS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<eAAS<<std::endl;
- std::cout<<"Tag storage = "<<eTS<<std::endl;
- std::cout<<"Amortized tag storage = "<<eATS<<std::endl;
- std::cout<<std::endl;
-
- return 0;
-}
-
diff --git a/test/perf/adj_without_ahf_mem_time.cpp b/test/perf/adj_without_ahf_mem_time.cpp
deleted file mode 100755
index cd4d58c..0000000
--- a/test/perf/adj_without_ahf_mem_time.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*This function tests the AHF datastructures on CST meshes*/
-#include <iostream>
-#include <assert.h>
-#include <time.h>
-#include <vector>
-#include "moab/Core.hpp"
-#include "moab/Range.hpp"
-#include "moab/MeshTopoUtil.hpp"
-#include "moab/HalfFacetRep.hpp"
-#include <sys/time.h>
-
-using namespace moab;
-
-#ifdef MESHDIR
-std::string TestDir(STRINGIFY(MESHDIR));
-#else
-std::string TestDir(".");
-#endif
-
-std::string filename;
-
-double wtime() {
- double y = -1;
- struct timeval cur_time;
- gettimeofday(&cur_time, NULL);
- y = (double)(cur_time.tv_sec) + (double)(cur_time.tv_usec)*1.e-6;
- return (y);
-}
-
-int main(int argc, char **argv)
-{
- // Read the input mesh
- filename = TestDir + "/hexes_mixed.vtk";
-
- if (argc==1)
- std::cout<<"Using default input file:"<<filename<<std::endl;
- else if (argc==2)
- filename = argv[1];
- else {
- std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl;
- return 1;
- }
-
- ErrorCode error;
- Core moab;
- Interface* mbImpl = &moab;
- MeshTopoUtil mtu(mbImpl);
-
- error = mbImpl->load_file( filename.c_str());
- if (MB_SUCCESS != error) {
- std::cerr << filename <<": failed to load file." << std::endl;
- return error;
- }
-
- //Create ranges for handles of explicit elements of the mixed mesh
- Range verts, edges, faces, cells;
- error = mbImpl->get_entities_by_dimension( 0, 0, verts);
- error = mbImpl->get_entities_by_dimension( 0, 1, edges);
- error = mbImpl->get_entities_by_dimension( 0, 2, faces);
- error = mbImpl->get_entities_by_dimension( 0, 3, cells);
-
- int nverts = verts.size();
- int nedges = edges.size();
- int nfaces = faces.size();
- int ncells = cells.size();
-
- std::cout<<"nverts = "<<nverts<<", nedges = "<<nedges<<", nfaces = "<<nfaces<<", ncells = "<<ncells<<std::endl;
-
-
- //Storage Costs before calling ahf functionalities
- std::cout<<std::endl;
- std::cout<<"STORAGE BEFORE CALLING ADJACENCIES"<<std::endl;
- unsigned long sTotS, sTAS, sES, sAES, sAS, sAAS, sTS, sATS;
- sTotS = sTAS = sES = sAES = sAS = sAAS = sTS = sATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &sTotS, &sTAS, &sES, &sAES, &sAS, &sAAS, NULL, 0, &sTS, &sATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<sTotS<<std::endl;
- std::cout<<"Total amortized storage = "<<sTAS<<std::endl;
- std::cout<<"Entity storage = "<<sES<<std::endl;
- std::cout<<"Amortized entity storage = "<<sAES<<std::endl;
- std::cout<<"Adjacency storage = "<<sAS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<sAAS<<std::endl;
- std::cout<<"Tag storage = "<<sTS<<std::endl;
- std::cout<<"Amortized tag storage = "<<sATS<<std::endl;
- std::cout<<std::endl;
-
-
- double time_start, time_avg;
-
- //Perform queries
- std::vector<EntityHandle> mbents;
- Range ngbents;
-
- // This call should create all the necessary moab adjacency lists
- error = mbImpl->get_adjacencies( &*verts.begin(), 1, 1, false, mbents );
-
- //1D Queries //
- //IQ1: For every vertex, obtain incident edges
- std::cout<<"1D QUERIES"<<std::endl;
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 1, false, mbents );
- }
- time_avg = (wtime()-time_start)/(double)verts.size();
- std::cout<<"QUERY: Vertex -> Edges :: MOAB: Average time = "<< time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
- //NQ1: For every edge, obtain neighbor edges
- error = mtu.get_bridge_adjacencies( *edges.begin(), 0, 1, ngbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- ngbents.clear();
- error = mtu.get_bridge_adjacencies( *i, 0, 1, ngbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Edges :: MOAB: Average time = "<<time_avg<<" secs" << std::endl;
- std::cout<<std::endl;
-
-
- // 2D Queries
- std::cout<<"2D QUERIES"<<std::endl;
- //IQ21: For every vertex, obtain incident faces
- error = mbImpl->get_adjacencies( &*edges.begin(), 1, 2, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
- //IQ22: For every edge, obtain incident faces
- error = mbImpl->get_adjacencies( &*edges.begin(), 1, 2, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
- //NQ2: For every face, obtain neighbor faces
- error = mtu.get_bridge_adjacencies( *faces.begin(), 1, 2, ngbents);
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- ngbents.clear();
- error = mtu.get_bridge_adjacencies( *i, 1, 2, ngbents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Faces :: MOAB: Average time = "<< time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
-
- // 3D Queries
- std::cout<<"3D QUERIES"<<std::endl;
- //IQ31: For every vertex, obtain incident cells
- error = mbImpl->get_adjacencies(&*edges.begin(), 1, 3, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
- std::cout<<std::endl;
-
-
- // IQ 32: For every edge, obtain incident cells
- error = mbImpl->get_adjacencies(&*edges.begin(), 1, 3, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
- std::cout<<std::endl;
-
- //IQ32: For every face, obtain incident cells
- error = mbImpl->get_adjacencies(&*faces.begin(), 1, 3, false, mbents);
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
- std::cout<<std::endl;
-
- //NQ3: For every cell, obtain neighbor cells
- error = mtu.get_bridge_adjacencies( *cells.begin(), 2, 3, ngbents);
- time_start = wtime();
- for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
- ngbents.clear();
- error = mtu.get_bridge_adjacencies( *i, 2, 3, ngbents);
- }
- time_avg = (wtime()-time_start)/(double)cells.size();
- std::cout<<"QUERY: Cell -> Cells :: MOAB: Average time = "<< time_avg <<" secs" << std::endl;
- std::cout<<std::endl;
-
- //Storage Costs after calling ahf deinitialize
- std::cout<<std::endl;
- std::cout<<"STORAGE AFTER CALLING ADJACENCIES"<<std::endl;
- unsigned long eTotS, eTAS, eES, eAES, eAS, eAAS, eTS, eATS;
- eTotS = eTAS = eES = eAES = eAS = eAAS = eTS = eATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &eTotS, &eTAS, &eES, &eAES, &eAS, &eAAS, NULL, 0, &eTS, &eATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<eTotS<<std::endl;
- std::cout<<"Total amortized storage = "<<eTAS<<std::endl;
- std::cout<<"Entity storage = "<<eES<<std::endl;
- std::cout<<"Amortized entity storage = "<<eAES<<std::endl;
- std::cout<<"Adjacency storage = "<<eAS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<eAAS<<std::endl;
- std::cout<<"Tag storage = "<<eTS<<std::endl;
- std::cout<<"Amortized tag storage = "<<eATS<<std::endl;
- std::cout<<std::endl;
-
- return 0;
-}
-
diff --git a/test/perf/ahf_intfc_mem_time.cpp b/test/perf/ahf_intfc_mem_time.cpp
deleted file mode 100755
index 6d8ef14..0000000
--- a/test/perf/ahf_intfc_mem_time.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/*This function tests the AHF datastructures on CST meshes*/
-#include <iostream>
-#include <assert.h>
-#include <time.h>
-#include <vector>
-#include "moab/Core.hpp"
-#include "moab/Range.hpp"
-#include "moab/MeshTopoUtil.hpp"
-#include "moab/HalfFacetRep.hpp"
-#include <sys/time.h>
-
-using namespace moab;
-
-#ifdef MESHDIR
-std::string TestDir(STRINGIFY(MESHDIR));
-#else
-std::string TestDir(".");
-#endif
-
-std::string filename;
-
-double wtime() {
- double y = -1;
- struct timeval cur_time;
- gettimeofday(&cur_time, NULL);
- y = (double)(cur_time.tv_sec) + (double)(cur_time.tv_usec)*1.e-6;
- return (y);
-}
-
-int main(int argc, char **argv)
-{
- // Read the input mesh
- filename = TestDir + "/hexes_mixed.vtk";
-
- if (argc==1)
- std::cout<<"Using default input file:"<<filename<<std::endl;
- else if (argc==2)
- filename = argv[1];
- else {
- std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl;
- return 1;
- }
-
- ErrorCode error;
- Core moab;
- Interface* mbImpl = &moab;
- MeshTopoUtil mtu(mbImpl);
-
- error = mbImpl->load_file( filename.c_str());
- if (MB_SUCCESS != error) {
- std::cerr << filename <<": failed to load file." << std::endl;
- return error;
- }
-
- //Create ranges for handles of explicit elements of the mixed mesh
- Range verts, edges, faces, cells;
- error = mbImpl->get_entities_by_dimension( 0, 0, verts);
- error = mbImpl->get_entities_by_dimension( 0, 1, edges);
- error = mbImpl->get_entities_by_dimension( 0, 2, faces);
- error = mbImpl->get_entities_by_dimension( 0, 3, cells);
-
- int nverts = verts.size();
- int nedges = edges.size();
- int nfaces = faces.size();
- int ncells = cells.size();
-
- std::cout<<"nverts = "<<nverts<<", nedges = "<<nedges<<", nfaces = "<<nfaces<<", ncells = "<<ncells<<std::endl;
-
-
- //Storage Costs before calling ahf functionalities
- unsigned long sTotS, sTAS, sES, sAES, sAS, sAAS, sTS, sATS;
- sTotS = sTAS = sES = sAES = sAS = sAAS = sTS = sATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &sTotS, &sTAS, &sES, &sAES, &sAS, &sAAS, NULL, 0, &sTS, &sATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<sTotS<<std::endl;
- std::cout<<"Total amortized storage = "<<sTAS<<std::endl;
- std::cout<<"Entity storage = "<<sES<<std::endl;
- std::cout<<"Amortized entity storage = "<<sAES<<std::endl;
- std::cout<<"Adjacency storage = "<<sAS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<sAAS<<std::endl;
- std::cout<<"Tag storage = "<<sTS<<std::endl;
- std::cout<<"Amortized tag storage = "<<sATS<<std::endl;
- std::cout<<std::endl;
-
-
- double time_start, time_avg;
-
- //Storage Costs after calling ahf initialize
- unsigned long TotS, TAS, ES, AES, AS, AAS, TS, ATS;
- TotS = TAS = ES = AES = AS = AAS = TS = ATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &TotS, &TAS, &ES, &AES, &AS, &AAS, NULL, 0, &TS, &ATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<TotS<<std::endl;
- std::cout<<"Total amortized storage = "<<TAS<<std::endl;
- std::cout<<"Entity storage = "<<ES<<std::endl;
- std::cout<<"Amortized entity storage = "<<AES<<std::endl;
- std::cout<<"Adjacency storage = "<<AS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<AAS<<std::endl;
- std::cout<<"Tag storage = "<<TS<<std::endl;
- std::cout<<"Amortized tag storage = "<<ATS<<std::endl;
- std::cout<<std::endl;
-
- //Perform queries
- std::vector<EntityHandle> adjents;
- Range mbents;
-
- // This call should create all the necessary ahf maps
- error = mbImpl->get_adjacencies( &*verts.begin(), 1, 1, false, adjents );
-
- // This call should create all the necessary moab adjacency lists
- error = mbImpl->get_adjacencies( &*verts.begin(), 1, 1, false, mbents );
-
- //1D Queries //
- //IQ1: For every vertex, obtain incident edges
- std::cout<<"1D QUERIES"<<std::endl;
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)verts.size();
- std::cout<<"QUERY: Vertex -> Edges :: MOAB_AHF: Average time = "<< time_avg<<" secs" <<std::endl;
-
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 1, false, mbents );
- }
- time_avg = (wtime()-time_start)/(double)verts.size();
- std::cout<<"QUERY: Vertex -> Edges :: MOAB: Average time = "<< time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
- //NQ1: For every edge, obtain neighbor edges
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Edges :: MOAB_AHF: Average time = "<<time_avg<<" secs" << std::endl;
-
- error = mtu.get_bridge_adjacencies( *edges.begin(), 0, 1, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mtu.get_bridge_adjacencies( *i, 0, 1, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Edges :: MOAB: Average time = "<<time_avg<<" secs" << std::endl;
- std::cout<<std::endl;
-
-
- // 2D Queries
- std::cout<<"2D QUERIES"<<std::endl;
- //IQ21: For every vertex, obtain incident faces
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
-
- error = mbImpl->get_adjacencies( &*edges.begin(), 1, 2, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
- //IQ22: For every edge, obtain incident faces
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Faces :: MOAB_AHF: Average time = "<<time_avg<<" secs" <<std::endl;
-
- error = mbImpl->get_adjacencies( &*edges.begin(), 1, 2, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Faces :: MOAB: Average time = "<<time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
- //NQ2: For every face, obtain neighbor faces
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Faces :: MOAB_AHF: Average time = "<< time_avg<<" secs" <<std::endl;
-
- error = mtu.get_bridge_adjacencies( *faces.begin(), 1, 2, mbents);
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- mbents.clear();
- error = mtu.get_bridge_adjacencies( *i, 1, 2, mbents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Faces :: MOAB: Average time = "<< time_avg<<" secs" <<std::endl;
- std::cout<<std::endl;
-
-
- // 3D Queries
- std::cout<<"3D QUERIES"<<std::endl;
- //IQ31: For every vertex, obtain incident cells
- time_start = wtime();
- for (Range::iterator i = verts.begin(); i != verts.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
-
- error = mbImpl->get_adjacencies(&*edges.begin(), 1, 3, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Vertex -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
- std::cout<<std::endl;
-
-
- // IQ 32: For every edge, obtain incident cells
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
-
- error = mbImpl->get_adjacencies(&*edges.begin(), 1, 3, false, mbents);
- time_start = wtime();
- for (Range::iterator i = edges.begin(); i != edges.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)edges.size();
- std::cout<<"QUERY: Edge -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
- std::cout<<std::endl;
-
- //IQ32: For every face, obtain incident cells
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Cells :: MOAB_AHF: Average time = "<<time_avg <<" secs"<<std::endl;
-
- error = mbImpl->get_adjacencies(&*faces.begin(), 1, 3, false, mbents);
- time_start = wtime();
- for (Range::iterator i = faces.begin(); i != faces.end(); ++i) {
- mbents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, mbents);
- }
- time_avg = (wtime()-time_start)/(double)faces.size();
- std::cout<<"QUERY: Face -> Cells :: MOAB: Average time = "<<time_avg <<" secs"<<std::endl;
- std::cout<<std::endl;
-
- //NQ3: For every cell, obtain neighbor cells
- time_start = wtime();
- for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
- adjents.clear();
- error = mbImpl->get_adjacencies(&*i, 1, 3, false, adjents);
- }
- time_avg = (wtime()-time_start)/(double)cells.size();
- std::cout<<"QUERY: Cell -> Cells :: MOAB_AHF: Average time = "<< time_avg <<" secs" << std::endl;
-
- error = mtu.get_bridge_adjacencies( *cells.begin(), 2, 3, mbents);
- time_start = wtime();
- for (Range::iterator i = cells.begin(); i != cells.end(); ++i) {
- mbents.clear();
- error = mtu.get_bridge_adjacencies( *i, 2, 3, mbents);
- }
- time_avg = (wtime()-time_start)/(double)cells.size();
- std::cout<<"QUERY: Cell -> Cells :: MOAB: Average time = "<< time_avg <<" secs" << std::endl;
- std::cout<<std::endl;
-
- //Storage Costs after calling ahf deinitialize
- unsigned long eTotS, eTAS, eES, eAES, eAS, eAAS, eTS, eATS;
- eTotS = eTAS = eES = eAES = eAS = eAAS = eTS = eATS = 0;
- mbImpl->estimated_memory_use(NULL, 0, &eTotS, &eTAS, &eES, &eAES, &eAS, &eAAS, NULL, 0, &eTS, &eATS);
- std::cout<<std::endl;
- std::cout<<"Total storage = "<<eTotS<<std::endl;
- std::cout<<"Total amortized storage = "<<eTAS<<std::endl;
- std::cout<<"Entity storage = "<<eES<<std::endl;
- std::cout<<"Amortized entity storage = "<<eAES<<std::endl;
- std::cout<<"Adjacency storage = "<<eAS<<std::endl;
- std::cout<<"Amortized adjacency storage = "<<eAAS<<std::endl;
- std::cout<<"Tag storage = "<<eTS<<std::endl;
- std::cout<<"Amortized tag storage = "<<eATS<<std::endl;
- std::cout<<std::endl;
-
- return 0;
-}
-
This diff is so big that we needed to truncate the remainder.
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.
1
0
2 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/666986dff22d/
Changeset: 666986dff22d
Branch: None
User: iulian07
Date: 2014-07-10 21:27:11
Summary: add option for faces and edges
it will create faces and edges too, and output them to the file
They will not be part of parallel partition
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 5918a09..25cbaa0 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -70,6 +70,7 @@ int main(int argc, char **argv)
bool quadratic=false;
bool keep_skins=false;
bool tetra = false;
+ bool adjEnts = false;
MPI_Init(&argc, &argv);
@@ -103,6 +104,8 @@ int main(int argc, char **argv)
opts.addOpt<void>("tetrahedrons,t", "generate tetrahedrons ",
&tetra);
+ opts.addOpt<void>("faces_edges,f", "create all faces and edges", &adjEnts);
+
vector<string> intTagNames;
string firstIntTag;
opts.addOpt<string>(std::string("int_tag_vert,i"), string("add integer tag on vertices"), &firstIntTag);
@@ -143,6 +146,10 @@ int main(int argc, char **argv)
return 1;
}
+ if (adjEnts)
+ {
+ keep_skins = true; // do not delete anything
+ }
// determine m, n, k for processor rank
int m,n,k;
k = rank/(M*N);
@@ -473,6 +480,15 @@ int main(int argc, char **argv)
tt = clock();
}
+ if (adjEnts)
+ {
+ // generate all adj entities dimension 1 and 2 (edges and faces/ tri or quads)
+ Range edges, faces;
+ rval = mb->get_adjacencies(all3dcells, 1, true, edges, Interface::UNION );
+ CHECKE("Can't get edges");
+ rval = mb->get_adjacencies(all3dcells, 2, true, faces, Interface::UNION );
+ CHECKE("Can't get faces");
+ }
ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
if (pcomm==NULL)
{
https://bitbucket.org/fathomteam/moab/commits/469ad6916df4/
Changeset: 469ad6916df4
Branch: iulian07/largemesh
User: iulian07
Date: 2014-07-11 00:24:29
Summary: the edges and faces should be added to the partition
if created, it would be better to put the edges and faces to their partitions
for this, create them early, in the loop
Need to update adjacencies, otherwise next time in the loop it does not work
(to create edges and faces based on adjacencies)
it is the n-th time I made this mistake :(
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 25cbaa0..4ec1e1b 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -267,16 +267,23 @@ int main(int argc, char **argv)
EntityHandle starte; // connectivity
EntityHandle * conn;
+ int num_v_per_elem = 8;
if (quadratic)
+ {
+ num_v_per_elem = 27;
rval = iface->get_element_connect(num_el, 27, MBHEX, 0, starte, conn);
+ }
else if (tetra)
+ {
+ num_v_per_elem = 4;
rval = iface->get_element_connect(num_el, 4, MBTET, 0, starte, conn);
+ }
else
rval = iface->get_element_connect(num_el, 8, MBHEX, 0, starte, conn);
CHECKE("Can't get element connectivity.");
- Range hexas(starte, starte+num_el-1); // should be elements
- // fill hexas
+ Range cells(starte, starte+num_el-1); // should be elements
+ // fill cells
ix=0;
// identify the elements at the lower corner, for their global ids
int xe = m*A*blockSize + a*blockSize;
@@ -432,9 +439,28 @@ int main(int argc, char **argv)
EntityHandle part_set;
rval = mb->create_meshset(MESHSET_SET, part_set);
CHECKE("Can't create mesh set.");
- rval = mb->add_entities(part_set, hexas);
+ rval = mb->add_entities(part_set, cells);
CHECKE("Can't add entities to set.");
- rval = mb->tag_set_data(global_id_tag, hexas, &gids[0]);
+ // if needed, add all edges and faces
+ if (adjEnts)
+ {
+ // we need to update adjacencies now, because some elements are new
+ rval = iface->update_adjacencies(starte, num_el, num_v_per_elem, conn);
+ CHECKE("Can't update adjacencies");
+ // generate all adj entities dimension 1 and 2 (edges and faces/ tri or qua
+ Range edges, faces;
+ rval = mb->get_adjacencies(cells, 1, true, edges,
+ Interface::UNION);
+ CHECKE("Can't get edges");
+ rval = mb->get_adjacencies(cells, 2, true, faces,
+ Interface::UNION);
+ CHECKE("Can't get faces");
+ rval = mb->add_entities(part_set, edges);
+ CHECKE("Can't add edges to partition set.");
+ rval = mb->add_entities(part_set, faces);
+ CHECKE("Can't add faces to partition set.");
+ }
+ rval = mb->tag_set_data(global_id_tag, cells, &gids[0]);
CHECKE("Can't set global ids to elements.");
int part_num= a + m*A + (b + n*B)*(M*A) + (c+k*C)*(M*A * N*B);
rval = mb->tag_set_data(part_tag, &part_set, 1, &part_num);
@@ -480,15 +506,6 @@ int main(int argc, char **argv)
tt = clock();
}
- if (adjEnts)
- {
- // generate all adj entities dimension 1 and 2 (edges and faces/ tri or quads)
- Range edges, faces;
- rval = mb->get_adjacencies(all3dcells, 1, true, edges, Interface::UNION );
- CHECKE("Can't get edges");
- rval = mb->get_adjacencies(all3dcells, 2, true, faces, Interface::UNION );
- CHECKE("Can't get faces");
- }
ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
if (pcomm==NULL)
{
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.
1
0
version: (1.0rc1/svn r1016) moab compilation errors on BLUES/fusion
by Vegendla, Surya Narayana Prasad 10 Jul '14
by Vegendla, Surya Narayana Prasad 10 Jul '14
10 Jul '14
Hi all,
I am having the following moab compilation errors (svn r1016) while compiling on BLUES using moab_conjht example. Please let me know how to avoid these?
Here, attaching makenek and soft file for your reference.
Thanks,
Prasad
mpif77 -f77=ifort -c -O2 -r8 -fpconstant -fpp -DMOAB -DPTRSIZE8 -DMPI -DLONGINT8 -DUNDERSCORE -DGLOBAL_LONG_LONG -I/home/svegendla/nekFiles/moab_conjhtOld -I/home/svegendla/nek5_svn/trunk/nek -I./ /home/svegendla/nekFiles/moab_conjhtOld/moab_conjht.f -I/home/svegendla/nek5_svn/trunk/nek/3rd_party -DUNORDERED_MAP_NS=std::tr1 -DHAVE_UNORDERED_MAP=tr1/unordered_map -DHAVE_UNORDERED_SET=tr1/unordered_set -I/soft/netcdf/4.0.1-intel-11-serial/include -I/home/jain/lib/hdf5-1.8.7//include -isystem /home/jain/lib/hdf5-1.8.7//include -DTEMPLATE_SPECIALIZATION -DTEMPLATE_FUNC_SPECIALIZATION -DHAVE_VSNPRINTF -D_FILE_OFFSET_BITS=64 -DUSE_MPI -DHDF5_FILE -DHDF5_PARALLEL -DNETCDF_FILE -DCGM -I/home/jain/install/opt_moab//include -o obj/moab_conjht.o
mpif77 -f77=ifort -o nek5000 obj/moab_conjht.o obj/drive.o obj/drive1.o obj/drive2.o obj/plan4.o obj/bdry.o obj/coef.o obj/conduct.o obj/connect1.o obj/connect2.o obj/dssum.o obj/edgec.o obj/eigsolv.o obj/gauss.o obj/genxyz.o obj/navier1.o obj/makeq.o obj/navier0.o obj/navier2.o obj/navier3.o obj/navier4.o obj/prepost.o obj/speclib.o obj/map2.o obj/turb.o obj/mvmesh.o obj/ic.o obj/ssolv.o obj/planx.o obj/math.o obj/mxm_wrapper.o obj/hmholtz.o obj/gfdm_par.o obj/gfdm_op.o obj/gfdm_solve.o obj/subs1.o obj/subs2.o obj/genbox.o obj/gmres.o obj/hsmg.o obj/convect.o obj/induct.o obj/perturb.o obj/navier5.o obj/navier6.o obj/navier7.o obj/navier8.o obj/fast3d.o obj/fasts.o obj/calcz.o obj/byte.o obj/chelpers.o obj/byte_mpi.o obj/postpro.o obj/cvode_driver.o obj/nek_comm.o obj/init_plugin.o obj/setprop.o obj/qthermal.o obj/cvode_aux.o obj/makeq_aux.o obj/papi.o obj/nek_in_situ.o obj/mxm_std.o obj/blas.o obj/moab.o obj/imeshutil.o obj/imeshcutil.o obj/comm_mpi.o obj/singlmesh.o obj/dsygv.o obj/ssygv.o obj/jl_gs.o obj/jl_sort.o obj/jl_sarray_transfer.o obj/jl_sarray_sort.o obj/jl_gs_local.o obj/jl_crystal.o obj/jl_comm.o obj/jl_tensor.o obj/jl_fail.o obj/jl_fcrystal.o obj/jl_findpts.o obj/jl_findpts_local.o obj/jl_obbox.o obj/jl_poly.o obj/jl_lob_bnd.o obj/jl_findpts_el_3.o obj/jl_findpts_el_2.o obj/jl_sparse_cholesky.o obj/jl_xxt.o obj/jl_fcrs.o -L/soft/netcdf/4.0.1-intel-11-serial/lib -lnetcdf -L/home/jain/lib/hdf5-1.8.7//lib -L/home/jain/install/opt_cgm13/lib -L/home/jain/Cubit-13.1//bin -L/home/jain/install/opt_moab//lib -L/home/jain/install/opt_moab//lib -liMesh -lMOAB -lnetcdf -lhdf5 -lgpfs -lm -L/home/jain/install/opt_cgm13/lib -L/home/jain/Cubit-13.1//bin -lcgm -L/home/jain/Cubit-13.1//bin -lcubiti19 -lcubit_geom -lcubit_util
ld: warning: libgtcAttrib.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libCMLTet.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libcbtverdict.so.1.2, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: liblpsolve55.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkWidgets.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkIO.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkHybrid.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkVolumeRendering.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkRendering.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkImaging.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkGraphics.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkFiltering.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkCommon.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkDICOMParser.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkftgl.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkfreetype.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkexoIIc.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkNetCDF.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkverdict.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtksqlite.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkexpat.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkjpeg.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkpng.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtktiff.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtksys.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkzlib.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libvtkNetCDF_cxx.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libmesquite.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
ld: warning: libSpaACIS.so, needed by /home/jain/Cubit-13.1//bin/libcubiti19.so, not found (try using -rpath or -rpath-link)
/home/jain/lib/hdf5-1.8.7//lib/libhdf5.a(H5Zdeflate.o): In function `H5Z_filter_deflate':
/fusion/gpfs/home/jain/hdf5-1.8.7/src/H5Zdeflate.c:110: undefined reference to `inflateInit_'
/fusion/gpfs/home/jain/hdf5-1.8.7/src/H5Zdeflate.c:116: undefined reference to `inflate'
/fusion/gpfs/home/jain/hdf5-1.8.7/src/H5Zdeflate.c:180: undefined reference to `compress2'
/fusion/gpfs/home/jain/hdf5-1.8.7/src/H5Zdeflate.c:135: undefined reference to `inflateEnd'
/fusion/gpfs/home/jain/hdf5-1.8.7/src/H5Zdeflate.c:124: undefined reference to `inflateEnd'
/fusion/gpfs/home/jain/hdf5-1.8.7/src/H5Zdeflate.c:157: undefined reference to `inflateEnd'
ld: nek5000: hidden symbol `stat' in /usr/lib64/libc_nonshared.a(stat.oS) is referenced by DSO
ld: final link failed: Nonrepresentable section on output
make: *** [nek5000] Error 1
2
1
The Buildbot has detected a failed build on builder moab-large while building SIGMA.
Full details are available at:
http://gnep.mcs.anl.gov:8010/builders/moab-large/builds/3
Buildbot URL: http://gnep.mcs.anl.gov:8010/
Buildslave for this Build: gnep
Build Reason: downstream
Build Source Stamp: HEAD
Blamelist:
BUILD FAILED: failed shell_4 shell_5
sincerely,
-The Buildbot
1
0
10 Jul '14
The Buildbot has detected a failed build on builder test-vijaysm/fix-warnings while building SIGMA.
Full details are available at:
http://gnep.mcs.anl.gov:8010/builders/test-vijaysm%2Ffix-warnings/builds/1
Buildbot URL: http://gnep.mcs.anl.gov:8010/
Buildslave for this Build: gnep
Build Reason: downstream
Build Source Stamp: HEAD
Blamelist:
BUILD FAILED: failed shell shell_2 shell_4 shell_5
sincerely,
-The Buildbot
2
1
11 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/2b453254fb81/
Changeset: 2b453254fb81
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: add large mesh example
Affected #: 2 files
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
new file mode 100644
index 0000000..6ef1dc9
--- /dev/null
+++ b/examples/GenLargeMesh.cpp
@@ -0,0 +1,105 @@
+/** @example GenLargeMesh.cpp \n
+ * \brief Create a large structured mesh, partitioned \n
+ * <b>To run</b>: mpiexec -np 2 GenLargeMesh \n
+ *
+ * It shows how to load create a mesh on the fly, on multiple
+ * processors, block wise
+ * Each processor will create its version of a block mesh, partitioned
+ * as AxBxC blocks. Each block will be with blockSize^3 hexahedrons, and will get a
+ * different PARALLEL_PARTITION tag
+ *
+ * The number of tasks will be MxNxK, and it must match the mpi size
+ * Each task will generate its mesh at location (m,n,k)
+ *
+ * By default M=2, N=1, K=1, so by default it should be launched on 2 procs
+ * By default, blockSize is 4, and A=2, B=2, C=2, so each task will generate locally
+ * blockSize^3 x A x B x C hexahedrons (value = 64x8 = 512 hexas, in 8 partitions)
+ *
+ * The total number f partitions will be A*B*C*M*N*K (default 16)
+ *
+ * Each part in partition will get a proper tag
+ *
+ * The vertices will get a proper global id, which will be used to resolve the
+ * shared entities
+ * The output will be written in parallel, and we will try sizes as big as we can
+ * (up to a billion vertices, because we use int for global ids)
+ *
+ * Within each partition, the hexas will be numbered contiguously, and also the
+ * vertices; The global id will be determined easily, for a vertex, but the entity
+ * handle space will be more interesting to handle, within a partition (we want
+ * contiguous handles within a partition)
+ *
+ * We may or may not use ScdInterface, because we want control over global id and
+ * entity handle within a partition
+ *
+ *
+ * mpiexec -np 2 GenLargeMesh
+ */
+
+#include "moab/Core.hpp"
+#include "moab/ProgOptions.hpp"
+#include "moab/ParallelComm.hpp"
+#include "moab/CN.hpp"
+
+#include <iostream>
+#include <vector>
+
+using namespace moab;
+using namespace std;
+int main(int argc, char **argv)
+{
+ int A=2, B=2, C=2, M=2, N=1, K=1;
+ int blockSize = 4;
+
+ MPI_Init(&argc, &argv);
+
+ ProgOptions opts;
+
+ opts.addOpt<int>(std::string("blockSize,b"),
+ std::string("Block size of mesh (default=4)"), &blockSize);
+ opts.addOpt<int>(std::string("xproc,M"),
+ std::string("Number of processors in x dir (default=2)"), &M);
+ opts.addOpt<int>(std::string("yproc,N"),
+ std::string("Number of processors in y dir (default=1)"), &N);
+ opts.addOpt<int>(std::string("zproc,K"),
+ std::string("Number of processors in z dir (default=1)"), &K);
+
+ opts.addOpt<int>(std::string("xblocks,A"),
+ std::string("Number of blocks on a task in x dir (default=2)"), &A);
+ opts.addOpt<int>(std::string("yblocks,B"),
+ std::string("Number of blocks on a task in y dir (default=2)"), &B);
+ opts.addOpt<int>(std::string("zblocks,C"),
+ std::string("Number of blocks on a task in x dir (default=2)"), &C);
+
+
+ opts.parseCommandLine(argc, argv);
+
+ Interface* mb = new Core;
+ if (NULL == mb)
+ {
+ MPI_Finalize();
+ return 1;
+ }
+
+ MPI_Comm comm ;
+ int rank, size;
+ MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+ MPI_Comm_rank( MPI_COMM_WORLD, &size );
+
+ if (M*N*K != size)
+ {
+ if (rank==0)
+ {
+ cout <<"M*N*K=" << M*N*K << " != size = "<< " size\n";
+ }
+ MPI_Finalize();
+ return 1;
+ }
+
+ // the global id of each vertex will be, on task
+
+ MPI_Finalize();
+ return 0;
+}
+
+
diff --git a/examples/makefile b/examples/makefile
index 787c8d3..f41def7 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -71,6 +71,9 @@ VisTags: VisTags.o ${MOAB_LIBDIR}/libMOAB.la
ReadWriteTest: ReadWriteTest.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+GenLargeMesh: GenLargeMesh.o ${MOAB_LIBDIR}/libMOAB.la
+ ${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
clean:
rm -rf *.o *.mod *.h5m ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
https://bitbucket.org/fathomteam/moab/commits/470cb969e6b2/
Changeset: 470cb969e6b2
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: is_valid should be on the interface too
not only on the Core.hpp
How do we know if an entity handle is valid or not?
is there another way?
Affected #: 1 file
diff --git a/src/moab/Interface.hpp b/src/moab/Interface.hpp
index 09f4219..c8102b8 100644
--- a/src/moab/Interface.hpp
+++ b/src/moab/Interface.hpp
@@ -1981,6 +1981,8 @@ public:
SetIterator *&set_iter) = 0;
/**@}*/
+
+ virtual bool is_valid(EntityHandle entity) const = 0;
};
//! predicate for STL algorithms. Returns true if the entity handle is
https://bitbucket.org/fathomteam/moab/commits/958dd1fb40c4/
Changeset: 958dd1fb40c4
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: validate sharedEnts
it is becoming important if some entities are deleted after they are resolved
they are part of the sharedEnts vector, but they are not deleted
from there.
This is the advantage of keeping entities in lists in member data
we should hunt them down :(
Affected #: 2 files
diff --git a/src/parallel/ParallelComm.cpp b/src/parallel/ParallelComm.cpp
index 10ce709..a8571af 100644
--- a/src/parallel/ParallelComm.cpp
+++ b/src/parallel/ParallelComm.cpp
@@ -8789,7 +8789,22 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
return MB_SUCCESS;
// end copy
+}
+ErrorCode ParallelComm::correct_shared_entities()
+{
+
+ std::vector<EntityHandle> good_ents;
+ for (size_t i=0; i<sharedEnts.size(); i++)
+ {
+ if (mbImpl->is_valid(sharedEnts[i]))
+ {
+ good_ents.push_back(sharedEnts[i]);
+ }
}
+ sharedEnts = good_ents;
+
+ return MB_SUCCESS;
+}
void ParallelComm::print_pstatus(unsigned char pstat, std::string &ostr)
{
diff --git a/src/parallel/moab/ParallelComm.hpp b/src/parallel/moab/ParallelComm.hpp
index 3424c51..2a16ac2 100644
--- a/src/parallel/moab/ParallelComm.hpp
+++ b/src/parallel/moab/ParallelComm.hpp
@@ -932,6 +932,12 @@ namespace moab {
ErrorCode settle_intersection_points(Range & edges, Range & shared_edges_owned,
std::vector<std::vector<EntityHandle> *> & extraNodesVec, double tolerance);
+ /* \brief check the shared entities if they exist anymore
+ * will check the shared ents array, and clean it if necessary
+ *
+ */
+ ErrorCode correct_shared_entities();
+
private:
ErrorCode reduce_void(int tag_data_type, const MPI_Op mpi_op, int num_ents, void *old_vals, void *new_vals);
https://bitbucket.org/fathomteam/moab/commits/0396abf065ac/
Changeset: 0396abf065ac
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: improve the large mesh example
this example pushes the limits of moab
It will be used later to create meshes larger than 1 billion vertices
Each processor creates a structure of AxBxC blocks, each block with
blockSize ^ 3 hexas
The example should be run on MxNxK array of processors.
After resolving and sharing the vertices, mesh is written in
parallel.
each block will represent a partition
It is different than test paralle_write_test because there the number
of partitions created is equal to the number of processors.
Here, each processor creates AxBxC partitions
For a total of AxBxC x MxNxK partitions
block size, A, B, .., K are options, with default values
The total number of hexas will be
AxBxC x MxNxK x block^3
edges and faces are removed after resolve sharing
the file will have just vertices and hexas, and it will be already
partitioned
We will add some tags of interest, to make it better.
The writer failed if I just deleted the edges and faces.
I had to introduce a method to correct sharedEnts in PC
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 6ef1dc9..1e0fa73 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -40,12 +40,16 @@
#include "moab/ProgOptions.hpp"
#include "moab/ParallelComm.hpp"
#include "moab/CN.hpp"
+#include "moab/ReadUtilIface.hpp"
+#include "moab/MergeMesh.hpp"
#include <iostream>
#include <vector>
using namespace moab;
using namespace std;
+
+#define CHECKE(message) if(rval != MB_SUCCESS) { cout << (message) << "\n"; MPI_Finalize(); return 1; }
int main(int argc, char **argv)
{
int A=2, B=2, C=2, M=2, N=1, K=1;
@@ -58,7 +62,7 @@ int main(int argc, char **argv)
opts.addOpt<int>(std::string("blockSize,b"),
std::string("Block size of mesh (default=4)"), &blockSize);
opts.addOpt<int>(std::string("xproc,M"),
- std::string("Number of processors in x dir (default=2)"), &M);
+ std::string("Number of processors in x dir (default=1)"), &M);
opts.addOpt<int>(std::string("yproc,N"),
std::string("Number of processors in y dir (default=1)"), &N);
opts.addOpt<int>(std::string("zproc,K"),
@@ -80,23 +84,175 @@ int main(int argc, char **argv)
MPI_Finalize();
return 1;
}
+ ReadUtilIface *iface;
+ ErrorCode rval = mb->query_interface(iface);
+ CHECKE("Can't get reader interface");
- MPI_Comm comm ;
int rank, size;
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_rank( MPI_COMM_WORLD, &size );
+ MPI_Comm_size( MPI_COMM_WORLD, &size );
if (M*N*K != size)
{
if (rank==0)
{
- cout <<"M*N*K=" << M*N*K << " != size = "<< " size\n";
+ cout <<"M*N*K=" << M*N*K << " != size = "<< size << "\n";
}
MPI_Finalize();
return 1;
}
- // the global id of each vertex will be, on task
+ // determine m, n, k for processor rank
+ int m,n,k;
+ k = rank/(M*N);
+ int leftover = rank%(M*N);
+ n = leftover/M;
+ m = leftover%M;
+ if (rank==size-1)
+ {
+ cout << "m, n, k for last rank:" << m << " " << n << " " << k << "\n";
+ }
+
+ // so there are a total of M * A * blockSize elements in x direction (so M * A * blockSize + 1 verts in x direction)
+ // so there are a total of N * B * blockSize elements in y direction (so N * B * blockSize + 1 verts in y direction)
+ // so there are a total of K * C * blockSize elements in z direction (so K * C * blockSize + 1 verts in z direction)
+
+ // there are ( M * A blockSize ) * ( N * B * blockSize) * (K * C * blockSize ) hexas
+ // there are ( M * A * blockSize + 1) * ( N * B * blockSize + 1 ) * (K * C * blockSize + 1) vertices
+ // x is the first dimension that varies
+
+ int NX = ( M * A * blockSize + 1);
+ int NY = ( N * B * blockSize + 1);
+ int NZ = ( K * C * blockSize + 1);
+ int blockSize1 = blockSize + 1;// used for vertices
+ int bsq = blockSize * blockSize;
+ int b1sq = blockSize1 * blockSize1;
+ // generate the block at (a, b, c); it will represent a partition , it will get a partition tag
+
+ Tag global_id_tag;
+ mb->tag_get_handle("GLOBAL_ID", 1, MB_TYPE_INTEGER,
+ global_id_tag);
+
+ Tag part_tag;
+ int dum_id=-1;
+ mb->tag_get_handle("PARALLEL_PARTITION", 1, MB_TYPE_INTEGER,
+ part_tag, MB_TAG_CREAT|MB_TAG_SPARSE, &dum_id);
+
+ for (int a=0; a<A; a++)
+ {
+ for (int b=0; b<B; b++)
+ {
+ for (int c=0; c<C; c++)
+ {
+ // we will generate (block+1)^3 vertices, and block^3 hexas
+ // the global id of the vertices will come from m, n, k, a, b, c
+ // x will vary from m*A*block + a*block to m*A*block+(a+1)*block etc;
+ int num_nodes = (blockSize+1)*(blockSize+1)*(blockSize+1);
+
+ vector<double*> arrays;
+ EntityHandle startv;
+ rval = iface->get_node_coords(3, num_nodes, 0, startv, arrays);
+ CHECKE("Can't get node coords.");
+
+ int x = m*A*blockSize + a*blockSize;
+ int y = n*B*blockSize + b*blockSize;
+ int z = k*C*blockSize + c*blockSize;
+ int ix=0;
+ vector<int> gids(num_nodes);
+ Range verts(startv, startv+num_nodes-1);
+ for (int kk=0; kk<blockSize+1; kk++)
+ {
+ for (int jj=0; jj<blockSize+1; jj++)
+ {
+ for (int ii=0; ii<blockSize+1; ii++)
+ {
+ arrays[0][ix] = (double)x+ii;
+ arrays[1][ix] = (double)y+jj;
+ arrays[2][ix] = (double)z+kk;
+ gids[ix] = 1 + (z+kk) * (NX*NY) + (y+jj) * NX + (x+ii);
+ ix++;
+ }
+ }
+ }
+ mb->tag_set_data(global_id_tag, verts, &gids[0]);
+ int num_hexas = (blockSize)*(blockSize)*(blockSize);
+ EntityHandle starte; // connectivity
+ EntityHandle * conn;
+ rval = iface->get_element_connect(num_hexas, 8, MBHEX, 0, starte, conn);
+ CHECKE("Can't get hexa connectivity.");
+
+ Range hexas(starte, starte+num_hexas-1);
+ // fill hexas
+ ix=0;
+ for (int kk=0; kk<blockSize; kk++)
+ {
+ for (int jj=0; jj<blockSize; jj++)
+ {
+ for (int ii=0; ii<blockSize; ii++)
+ {
+ EntityHandle corner=startv + ii + (jj*blockSize1) + kk * b1sq;
+ conn[ix]=corner;
+ conn[ix+1]=corner+1;
+ conn[ix+2]=corner+ 1 + blockSize1;
+ conn[ix+3]=corner+ blockSize1;
+ conn[ix+4]=corner + b1sq;
+ conn[ix+5]=corner+1 + b1sq;
+ conn[ix+6]=corner+ 1 + blockSize1 + b1sq;
+ conn[ix+7]=corner+ blockSize1 + b1sq;
+ ix+=8;
+ }
+ }
+ }
+ EntityHandle part_set;
+ rval = mb->create_meshset(MESHSET_SET, part_set);
+ CHECKE("Can't create mesh set.");
+ rval = mb->add_entities(part_set, hexas);
+ CHECKE("Can't add entities to set.");
+ int part_num= a + m*A + (b + n*B)*(M*A) + (c+k*C)*(M*A * N*B);
+ rval = mb->tag_set_data(part_tag, &part_set, 1, &part_num);
+ CHECKE("Can't set part tag on set");
+
+
+
+ }
+ }
+ }
+ // after the mesh is generated on each proc, merge the vertices
+ MergeMesh mm(mb);
+ Range allhexas;
+ rval = mb->get_entities_by_type(0, MBHEX, allhexas);
+
+ CHECKE("Can't get all hexa elements.");
+
+ rval = mm.merge_entities( allhexas, 0.0001);
+ CHECKE("Can't merge");
+ ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
+ if (pcomm==NULL)
+ {
+ pcomm = new ParallelComm( mb, MPI_COMM_WORLD );
+ }
+ rval = pcomm->resolve_shared_ents( 0, allhexas, 3, 0 );
+ CHECKE("Can't resolve shared ents");
+
+ // delete all quads and edges
+ Range toDelete;
+ rval = mb->get_entities_by_dimension(0, 1, toDelete);
+ CHECKE("Can't get edges");
+ rval = mb->delete_entities(toDelete);
+ CHECKE("Can't delete edges");
+
+ toDelete.clear();
+
+ rval = mb->get_entities_by_dimension(0, 2, toDelete);
+ CHECKE("Can't get faces");
+ rval = mb->delete_entities(toDelete);
+ CHECKE("Can't delete faces");
+
+ rval = pcomm->correct_shared_entities() ;
+ CHECKE("Can't correct local shared")
+
+ rval = mb->write_file("test1.h5m", 0, ";;PARALLEL=WRITE_PART");
+ CHECKE("Can't write in parallel");
MPI_Finalize();
return 0;
https://bitbucket.org/fathomteam/moab/commits/ed8df13ec5cc/
Changeset: ed8df13ec5cc
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: changes to the large structured mesh example
fun project
see how big of a model we can write in moab
use a different merging strategy, in which the global id tag is
used for determining what should be merged. (instead of a
adaptive KD tree)
It took 21 minutes on a task to merge a mesh with 500k vertices
This is ridiculous; the new method takes 3 minutes
I think that there is still room for improvement.
In the new method, we get the tag on each vertex and then order
The vertices that get the same tag will be merged (duh..)
It is away to generate a big model on a small machine
This new merging method might need a new branch/pull request
Maybe this will be accepted as is :) I will not hold my breath.
Still, right now it took 21 minutes to merge locally an 80x80x80
mesh
this is way too much. With the new method (-w option) it is taking less,
Still need to quantify
Affected #: 3 files
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 1e0fa73..52cca34 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -42,6 +42,7 @@
#include "moab/CN.hpp"
#include "moab/ReadUtilIface.hpp"
#include "moab/MergeMesh.hpp"
+#include <time.h>
#include <iostream>
#include <vector>
@@ -52,9 +53,11 @@ using namespace std;
#define CHECKE(message) if(rval != MB_SUCCESS) { cout << (message) << "\n"; MPI_Finalize(); return 1; }
int main(int argc, char **argv)
{
- int A=2, B=2, C=2, M=2, N=1, K=1;
+ int A=2, B=2, C=2, M=1, N=1, K=1;
int blockSize = 4;
+ bool newMergeMethod=false;
+
MPI_Init(&argc, &argv);
ProgOptions opts;
@@ -75,6 +78,8 @@ int main(int argc, char **argv)
opts.addOpt<int>(std::string("zblocks,C"),
std::string("Number of blocks on a task in x dir (default=2)"), &C);
+ opts.addOpt<void>("newMerge,w", "use new merging method",
+ &newMergeMethod);
opts.parseCommandLine(argc, argv);
@@ -121,11 +126,13 @@ int main(int argc, char **argv)
// there are ( M * A * blockSize + 1) * ( N * B * blockSize + 1 ) * (K * C * blockSize + 1) vertices
// x is the first dimension that varies
+ clock_t tt = clock();
+
int NX = ( M * A * blockSize + 1);
int NY = ( N * B * blockSize + 1);
- int NZ = ( K * C * blockSize + 1);
+ // int NZ = ( K * C * blockSize + 1); not used
int blockSize1 = blockSize + 1;// used for vertices
- int bsq = blockSize * blockSize;
+ // int bsq = blockSize * blockSize;
int b1sq = blockSize1 * blockSize1;
// generate the block at (a, b, c); it will represent a partition , it will get a partition tag
@@ -217,6 +224,14 @@ int main(int argc, char **argv)
}
}
}
+
+ if (0==rank)
+ {
+ std::cout << "generate local mesh: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
// after the mesh is generated on each proc, merge the vertices
MergeMesh mm(mb);
Range allhexas;
@@ -224,8 +239,23 @@ int main(int argc, char **argv)
CHECKE("Can't get all hexa elements.");
- rval = mm.merge_entities( allhexas, 0.0001);
+ Range verts;
+ rval = mb->get_entities_by_dimension(0, 0, verts);
+
+ CHECKE("Can't get all vertices.");
+
+ if (newMergeMethod)
+ rval = mm.merge_using_integer_tag( verts, global_id_tag);
+ else
+ rval = mm.merge_entities(allhexas, 0.0001);
CHECKE("Can't merge");
+ if (0==rank)
+ {
+ std::cout << "merge locally: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
if (pcomm==NULL)
{
@@ -234,6 +264,13 @@ int main(int argc, char **argv)
rval = pcomm->resolve_shared_ents( 0, allhexas, 3, 0 );
CHECKE("Can't resolve shared ents");
+ if (0==rank)
+ {
+ std::cout << "resolve shared entities: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
// delete all quads and edges
Range toDelete;
rval = mb->get_entities_by_dimension(0, 1, toDelete);
@@ -251,9 +288,23 @@ int main(int argc, char **argv)
rval = pcomm->correct_shared_entities() ;
CHECKE("Can't correct local shared")
+ if (0==rank)
+ {
+ std::cout << "delete edges and faces, and correct sharedEnts: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
rval = mb->write_file("test1.h5m", 0, ";;PARALLEL=WRITE_PART");
CHECKE("Can't write in parallel");
+ if (0==rank)
+ {
+ std::cout << "write file test1.h5m in parallel "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
MPI_Finalize();
return 0;
}
diff --git a/src/MergeMesh.cpp b/src/MergeMesh.cpp
index cb43b85..62b0022 100644
--- a/src/MergeMesh.cpp
+++ b/src/MergeMesh.cpp
@@ -139,7 +139,79 @@ ErrorCode MergeMesh::perform_merge(Tag merge_tag)
result = mbImpl->delete_entities(deadEnts);
return result;
}
+// merge vertices according to an input tag
+// merge them if the tags are equal
+struct handle_id
+{
+ EntityHandle eh;
+ int val;
+};
+
+// handle structure comparison function for qsort
+// if the id is the same , compare the handle.
+bool compare_handle_id(handle_id ia, handle_id ib) {
+
+ if(ia.val == ib.val) {
+ return ia.eh<ia.eh;
+ } else {
+ return ia.val<ib.val;
+ }
+}
+
+ErrorCode MergeMesh::merge_using_integer_tag(Range & verts, Tag user_tag, Tag merge_tag)
+{
+ ErrorCode rval;
+ DataType tag_type;
+ rval = mbImpl->tag_get_data_type(user_tag, tag_type);
+ if (rval!=MB_SUCCESS || tag_type!=MB_TYPE_INTEGER)
+ return MB_FAILURE;
+ std::vector<int> vals(verts.size());
+ rval = mbImpl->tag_get_data(user_tag, verts, &vals[0]);
+ if (rval!=MB_SUCCESS)
+ return rval;
+
+ if (0 == merge_tag)
+ {
+ EntityHandle def_val = 0;
+ rval = mbImpl->tag_get_handle("__merge_tag", 1, MB_TYPE_HANDLE, mbMergeTag,
+ MB_TAG_DENSE | MB_TAG_EXCL, &def_val);
+ if (MB_SUCCESS != rval)
+ return rval;
+ }
+ else
+ mbMergeTag = merge_tag;
+
+ std::vector<handle_id> handles(verts.size());
+ int i=0;
+ for (Range::iterator vit = verts.begin(); vit!= verts.end(); vit++ )
+ {
+ handles[i].eh=*vit;
+ handles[i].val = vals[i];
+ i++;
+ }
+ std::sort(handles.begin(), handles.end(), compare_handle_id);
+
+ i=0;
+ while (i<(int)verts.size()-1)
+ {
+ handle_id first = handles[i];
+ int j=i+1;
+ while (handles[j].val == first.val && j<(int)verts.size())
+ {
+ rval= mbImpl->tag_set_data(mbMergeTag, &(handles[j].eh), 1, &(first.eh));
+ if (rval!=MB_SUCCESS)
+ return rval;
+ deadEnts.insert(handles[j].eh);
+ j++;
+ }
+ i=j;
+ }
+
+ rval = perform_merge(mbMergeTag);
+
+ return rval;
+}
ErrorCode MergeMesh::find_merged_to(EntityHandle &tree_root,
AdaptiveKDTree &tree, Tag merge_tag)
{
diff --git a/src/moab/MergeMesh.hpp b/src/moab/MergeMesh.hpp
index 8eef9a8..8f4d5bc 100644
--- a/src/moab/MergeMesh.hpp
+++ b/src/moab/MergeMesh.hpp
@@ -32,6 +32,9 @@ public:
//Identify higher dimension to be merged
ErrorCode merge_higher_dimensions(Range &elems);
+ // merge vertices according to an input tag
+ ErrorCode merge_using_integer_tag(Range & verts, Tag user_tag, Tag merge_tag=0);
+
//- perform the actual merge
ErrorCode perform_merge(Tag merged_to);
private:
@@ -39,8 +42,6 @@ private:
double mergeTol, mergeTolSq;
- Tag mergeTag;
-
//- given a kdtree, set tag on vertices in leaf nodes with vertices
//- to which they should be merged
ErrorCode find_merged_to(EntityHandle &tree_root,
https://bitbucket.org/fathomteam/moab/commits/b186f4fcc905/
Changeset: b186f4fcc905
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: add quadratic option
with -q option, the hexas generated will be quadratic hex 27 elements
it will allow for more vertices compared to elements (~ 8 times more vertices)
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 52cca34..7de1a8b 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -57,6 +57,7 @@ int main(int argc, char **argv)
int blockSize = 4;
bool newMergeMethod=false;
+ bool quadratic=false;
MPI_Init(&argc, &argv);
@@ -81,6 +82,9 @@ int main(int argc, char **argv)
opts.addOpt<void>("newMerge,w", "use new merging method",
&newMergeMethod);
+ opts.addOpt<void>("quadratic,q", "use hex 27 elements",
+ &quadratic);
+
opts.parseCommandLine(argc, argv);
Interface* mb = new Core;
@@ -128,10 +132,16 @@ int main(int argc, char **argv)
clock_t tt = clock();
- int NX = ( M * A * blockSize + 1);
- int NY = ( N * B * blockSize + 1);
+ int q = 1;
+ if (quadratic)
+ {
+ q = 2;
+ }
+ int NX = (q * M * A * blockSize + 1);
+ int NY = (q * N * B * blockSize + 1);
// int NZ = ( K * C * blockSize + 1); not used
- int blockSize1 = blockSize + 1;// used for vertices
+ int blockSize1 = q*blockSize + 1;// used for vertices
+
// int bsq = blockSize * blockSize;
int b1sq = blockSize1 * blockSize1;
// generate the block at (a, b, c); it will represent a partition , it will get a partition tag
@@ -151,27 +161,28 @@ int main(int argc, char **argv)
{
for (int c=0; c<C; c++)
{
- // we will generate (block+1)^3 vertices, and block^3 hexas
+ // we will generate (q*block+1)^3 vertices, and block^3 hexas; q is 1 for linear, 2 for quadratic
// the global id of the vertices will come from m, n, k, a, b, c
- // x will vary from m*A*block + a*block to m*A*block+(a+1)*block etc;
- int num_nodes = (blockSize+1)*(blockSize+1)*(blockSize+1);
+ // x will vary from m*A*q*block + a*q*block to m*A*q*block+(a+1)*q*block etc;
+ int num_nodes = blockSize1*blockSize1*blockSize1;
vector<double*> arrays;
EntityHandle startv;
rval = iface->get_node_coords(3, num_nodes, 0, startv, arrays);
CHECKE("Can't get node coords.");
- int x = m*A*blockSize + a*blockSize;
- int y = n*B*blockSize + b*blockSize;
- int z = k*C*blockSize + c*blockSize;
+ // will start with the lower corner:
+ int x = m*A*q*blockSize + a*q*blockSize;
+ int y = n*B*q*blockSize + b*q*blockSize;
+ int z = k*C*q*blockSize + c*q*blockSize;
int ix=0;
vector<int> gids(num_nodes);
Range verts(startv, startv+num_nodes-1);
- for (int kk=0; kk<blockSize+1; kk++)
+ for (int kk=0; kk<blockSize1; kk++)
{
- for (int jj=0; jj<blockSize+1; jj++)
+ for (int jj=0; jj<blockSize1; jj++)
{
- for (int ii=0; ii<blockSize+1; ii++)
+ for (int ii=0; ii<blockSize1; ii++)
{
arrays[0][ix] = (double)x+ii;
arrays[1][ix] = (double)y+jj;
@@ -185,7 +196,12 @@ int main(int argc, char **argv)
int num_hexas = (blockSize)*(blockSize)*(blockSize);
EntityHandle starte; // connectivity
EntityHandle * conn;
- rval = iface->get_element_connect(num_hexas, 8, MBHEX, 0, starte, conn);
+ if (quadratic)
+ {
+ rval = iface->get_element_connect(num_hexas, 27, MBHEX, 0, starte, conn);
+ }
+ else
+ rval = iface->get_element_connect(num_hexas, 8, MBHEX, 0, starte, conn);
CHECKE("Can't get hexa connectivity.");
Range hexas(starte, starte+num_hexas-1);
@@ -197,16 +213,50 @@ int main(int argc, char **argv)
{
for (int ii=0; ii<blockSize; ii++)
{
- EntityHandle corner=startv + ii + (jj*blockSize1) + kk * b1sq;
- conn[ix]=corner;
- conn[ix+1]=corner+1;
- conn[ix+2]=corner+ 1 + blockSize1;
- conn[ix+3]=corner+ blockSize1;
- conn[ix+4]=corner + b1sq;
- conn[ix+5]=corner+1 + b1sq;
- conn[ix+6]=corner+ 1 + blockSize1 + b1sq;
- conn[ix+7]=corner+ blockSize1 + b1sq;
- ix+=8;
+ EntityHandle corner=startv + q*ii + (q*jj*blockSize1) + q*kk * b1sq;
+ if (quadratic)
+ {
+ conn[ix]=corner;
+ conn[ix+1]=corner+2;
+ conn[ix+2]=corner+2 + 2 * blockSize1;
+ conn[ix+3]=corner+ 2 * blockSize1;
+ conn[ix+4]=corner + 2 * b1sq;
+ conn[ix+5]=corner+ 2 + 2 * b1sq;
+ conn[ix+6]=corner+ 2 + 2 * blockSize1 + 2 * b1sq;
+ conn[ix+7]=corner+ 2*blockSize1 + 2*b1sq;
+ conn[ix+8]=corner + 1 ; // 0-1
+ conn[ix+9]= corner+ 2 + blockSize1; //1-2
+ conn[ix+10]= corner + 1 + 2 * blockSize1;// 2-3
+ conn[ix+11] =corner + blockSize1; // 3-0
+ conn[ix+12]= corner + b1sq; // 0-4
+ conn[ix+13]= corner+2 + b1sq; // 1-5
+ conn[ix+14]= corner + 2+ 2*blockSize1 + b1sq; // 2-6
+ conn[ix+15] = corner + 2* blockSize1 + b1sq; // 3-7
+ conn[ix+16] = corner + 1 + 2*b1sq; // 4-5
+ conn[ix+17] = corner + 2 + blockSize1 + 2* b1sq; //5-6
+ conn[ix+18] = corner + 1 + 2*blockSize1 + 2* b1sq; // 6-7
+ conn[ix+19] = corner + blockSize1 + 2* b1sq; // 4-7
+ conn[ix+20] = corner + 1 + b1sq; // 0154
+ conn[ix+21] = corner + 2 + blockSize1 + b1sq; // 1265
+ conn[ix+22] = corner + 1 + 2*blockSize1 + b1sq ; // 2376
+ conn[ix+23] = corner + blockSize1 + b1sq; // 0374
+ conn[ix+24] = corner + 1 + blockSize1 ; // 0123
+ conn[ix+25] = corner + 1 + blockSize1 + 2*b1sq; // 4567
+ conn[ix+26] = corner + 1 + blockSize1 + b1sq; // center
+ ix+=27;
+ }
+ else
+ {
+ conn[ix]=corner;
+ conn[ix+1]=corner+1;
+ conn[ix+2]=corner+ 1 + blockSize1;
+ conn[ix+3]=corner+ blockSize1;
+ conn[ix+4]=corner + b1sq;
+ conn[ix+5]=corner+1 + b1sq;
+ conn[ix+6]=corner+ 1 + blockSize1 + b1sq;
+ conn[ix+7]=corner+ blockSize1 + b1sq;
+ ix+=8;
+ }
}
}
}
@@ -232,6 +282,9 @@ int main(int argc, char **argv)
tt = clock();
}
+ // before merge locally
+ rval = mb->write_file("test0.h5m", 0, ";;PARALLEL=WRITE_PART");
+ CHECKE("Can't write in parallel, before merging");
// after the mesh is generated on each proc, merge the vertices
MergeMesh mm(mb);
Range allhexas;
https://bitbucket.org/fathomteam/moab/commits/e84552576ef5/
Changeset: e84552576ef5
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: add global id tag on elements too
also, add ystride and zstride variables, for clarity, and
a drawing with hex27 connectivity
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 7de1a8b..16cd9a0 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -11,11 +11,11 @@
* The number of tasks will be MxNxK, and it must match the mpi size
* Each task will generate its mesh at location (m,n,k)
*
- * By default M=2, N=1, K=1, so by default it should be launched on 2 procs
+ * By default M=1, N=1, K=1, so by default it should be launched on 1 proc
* By default, blockSize is 4, and A=2, B=2, C=2, so each task will generate locally
* blockSize^3 x A x B x C hexahedrons (value = 64x8 = 512 hexas, in 8 partitions)
*
- * The total number f partitions will be A*B*C*M*N*K (default 16)
+ * The total number of partitions will be A*B*C*M*N*K (default 8)
*
* Each part in partition will get a proper tag
*
@@ -33,7 +33,14 @@
* entity handle within a partition
*
*
- * mpiexec -np 2 GenLargeMesh
+ * to run: ./GenLargeMesh
+ *
+ * when launched on more procs, you have to make sure
+ * num procs = M*N*K
+ *
+ * so you can launch with
+ * mpiexec -np 8 ./GenLargeMesh -M 2 -N 2 -K 2
+ *
*/
#include "moab/Core.hpp"
@@ -139,11 +146,15 @@ int main(int argc, char **argv)
}
int NX = (q * M * A * blockSize + 1);
int NY = (q * N * B * blockSize + 1);
+ int nex = M * A * blockSize; // number of elements in x direction, used for global id on element
+ int ney = N * B * blockSize; // number of elements in y direction ....
// int NZ = ( K * C * blockSize + 1); not used
int blockSize1 = q*blockSize + 1;// used for vertices
- // int bsq = blockSize * blockSize;
- int b1sq = blockSize1 * blockSize1;
+ //int xstride = 1;
+ int ystride = blockSize1;
+
+ int zstride = blockSize1 * blockSize1;
// generate the block at (a, b, c); it will represent a partition , it will get a partition tag
Tag global_id_tag;
@@ -187,7 +198,7 @@ int main(int argc, char **argv)
arrays[0][ix] = (double)x+ii;
arrays[1][ix] = (double)y+jj;
arrays[2][ix] = (double)z+kk;
- gids[ix] = 1 + (z+kk) * (NX*NY) + (y+jj) * NX + (x+ii);
+ gids[ix] = 1 + (x+ii) + (y+jj) * NX + (z+kk) * (NX*NY) ;
ix++;
}
}
@@ -207,54 +218,79 @@ int main(int argc, char **argv)
Range hexas(starte, starte+num_hexas-1);
// fill hexas
ix=0;
+ // identify the elements at the lower corner, for their global ids
+ int xe = m*A*blockSize + a*blockSize;
+ int ye = n*B*blockSize + b*blockSize;
+ int ze = k*C*blockSize + c*blockSize;
+ gids.resize(num_hexas);
+ int ie=0; // index now in the elements, for global ids
for (int kk=0; kk<blockSize; kk++)
{
for (int jj=0; jj<blockSize; jj++)
{
for (int ii=0; ii<blockSize; ii++)
{
- EntityHandle corner=startv + q*ii + (q*jj*blockSize1) + q*kk * b1sq;
+ EntityHandle corner=startv + q * ii + q * jj * ystride + q * kk * zstride;
+ gids[ie] = 1 + (xe+ii) + (ye+jj) * nex + (ze+kk) * (nex*ney) ;
+ ie++;
if (quadratic)
{
- conn[ix]=corner;
- conn[ix+1]=corner+2;
- conn[ix+2]=corner+2 + 2 * blockSize1;
- conn[ix+3]=corner+ 2 * blockSize1;
- conn[ix+4]=corner + 2 * b1sq;
- conn[ix+5]=corner+ 2 + 2 * b1sq;
- conn[ix+6]=corner+ 2 + 2 * blockSize1 + 2 * b1sq;
- conn[ix+7]=corner+ 2*blockSize1 + 2*b1sq;
- conn[ix+8]=corner + 1 ; // 0-1
- conn[ix+9]= corner+ 2 + blockSize1; //1-2
- conn[ix+10]= corner + 1 + 2 * blockSize1;// 2-3
- conn[ix+11] =corner + blockSize1; // 3-0
- conn[ix+12]= corner + b1sq; // 0-4
- conn[ix+13]= corner+2 + b1sq; // 1-5
- conn[ix+14]= corner + 2+ 2*blockSize1 + b1sq; // 2-6
- conn[ix+15] = corner + 2* blockSize1 + b1sq; // 3-7
- conn[ix+16] = corner + 1 + 2*b1sq; // 4-5
- conn[ix+17] = corner + 2 + blockSize1 + 2* b1sq; //5-6
- conn[ix+18] = corner + 1 + 2*blockSize1 + 2* b1sq; // 6-7
- conn[ix+19] = corner + blockSize1 + 2* b1sq; // 4-7
- conn[ix+20] = corner + 1 + b1sq; // 0154
- conn[ix+21] = corner + 2 + blockSize1 + b1sq; // 1265
- conn[ix+22] = corner + 1 + 2*blockSize1 + b1sq ; // 2376
- conn[ix+23] = corner + blockSize1 + b1sq; // 0374
- conn[ix+24] = corner + 1 + blockSize1 ; // 0123
- conn[ix+25] = corner + 1 + blockSize1 + 2*b1sq; // 4567
- conn[ix+26] = corner + 1 + blockSize1 + b1sq; // center
+
+ // 4 ----- 19 ----- 7
+ // . | . |
+ // 16 25 18 |
+ // . | . |
+ // 5 ----- 17 ----- 6 |
+ // | 12 | 23 15
+ // | | |
+ // | 20 | 26 | 22 |
+ // | | |
+ // 13 21 | 14 |
+ // | 0 ----- 11 ----- 3
+ // | . | .
+ // | 8 24 | 10
+ // | . | .
+ // 1 ----- 9 ----- 2
+ //
+ conn[ix]= corner;
+ conn[ix+1]= corner + 2;
+ conn[ix+2]= corner + 2 + 2 * ystride;
+ conn[ix+3]= corner + 2 * ystride;
+ conn[ix+4]= corner + 2 * zstride;
+ conn[ix+5]= corner + 2 + 2 * zstride;
+ conn[ix+6]= corner + 2 + 2 * ystride + 2 * zstride;
+ conn[ix+7]= corner + 2 * ystride + 2 * zstride;
+ conn[ix+8]= corner + 1 ; // 0-1
+ conn[ix+9]= corner + 2 + ystride ; // 1-2
+ conn[ix+10]= corner + 1 + 2 * ystride ; // 2-3
+ conn[ix+11]= corner + ystride; // 3-0
+ conn[ix+12]= corner + zstride; // 0-4
+ conn[ix+13]= corner + 2 + zstride; // 1-5
+ conn[ix+14]= corner + 2 + 2 * ystride + zstride; // 2-6
+ conn[ix+15]= corner + 2 * ystride + zstride; // 3-7
+ conn[ix+16]= corner + 1 + 2 * zstride; // 4-5
+ conn[ix+17]= corner + 2 + ystride + 2 * zstride; //5-6
+ conn[ix+18]= corner + 1 + 2 * ystride + 2 * zstride; // 6-7
+ conn[ix+19]= corner + ystride + 2 * zstride; // 4-7
+ conn[ix+20]= corner + 1 + zstride; // 0154
+ conn[ix+21]= corner + 2 + ystride + zstride; // 1265
+ conn[ix+22]= corner + 1 + 2 * ystride + zstride; // 2376
+ conn[ix+23]= corner + ystride + zstride; // 0374
+ conn[ix+24]= corner + 1 + ystride ; // 0123
+ conn[ix+25]= corner + 1 + ystride + 2 * zstride; // 4567
+ conn[ix+26]= corner + 1 + ystride + zstride; // center
ix+=27;
}
else
{
- conn[ix]=corner;
- conn[ix+1]=corner+1;
- conn[ix+2]=corner+ 1 + blockSize1;
- conn[ix+3]=corner+ blockSize1;
- conn[ix+4]=corner + b1sq;
- conn[ix+5]=corner+1 + b1sq;
- conn[ix+6]=corner+ 1 + blockSize1 + b1sq;
- conn[ix+7]=corner+ blockSize1 + b1sq;
+ conn[ix]= corner;
+ conn[ix+1]=corner + 1;
+ conn[ix+2]=corner + 1 + ystride;
+ conn[ix+3]=corner + ystride;
+ conn[ix+4]=corner + zstride;
+ conn[ix+5]=corner + 1 + zstride;
+ conn[ix+6]=corner + 1 + ystride + zstride;
+ conn[ix+7]=corner + ystride + zstride;
ix+=8;
}
}
@@ -265,6 +301,8 @@ int main(int argc, char **argv)
CHECKE("Can't create mesh set.");
rval = mb->add_entities(part_set, hexas);
CHECKE("Can't add entities to set.");
+ rval = mb->tag_set_data(global_id_tag, hexas, &gids[0]);
+ CHECKE("Can't set global ids to elements.");
int part_num= a + m*A + (b + n*B)*(M*A) + (c+k*C)*(M*A * N*B);
rval = mb->tag_set_data(part_tag, &part_set, 1, &part_num);
CHECKE("Can't set part tag on set");
https://bitbucket.org/fathomteam/moab/commits/fc08a10c7f71/
Changeset: fc08a10c7f71
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: add tags to the large mesh example
use -i option for integer tags name on vertices,
and -d for double tags on cells
we can have multiple integer and double tags, with something like
GenLargeMesh -i tag1 -i tag2 -d tag3 -d tag4
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 16cd9a0..08dad08 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -92,8 +92,19 @@ int main(int argc, char **argv)
opts.addOpt<void>("quadratic,q", "use hex 27 elements",
&quadratic);
+ vector<string> intTagNames;
+ string firstIntTag;
+ opts.addOpt<string>(std::string("int_tag_vert,i"), string("add integer tag on vertices"), &firstIntTag);
+
+ vector<string> doubleTagNames;
+ string firstDoubleTag;
+ opts.addOpt<string>(std::string("double_tag_cell,d"), string("add double tag on cells"), &firstDoubleTag);
+
opts.parseCommandLine(argc, argv);
+ opts.getOptAllArgs("int_tag_vert,i", intTagNames);
+ opts.getOptAllArgs("double_tag_cell,d", doubleTagNames);
+
Interface* mb = new Core;
if (NULL == mb)
{
@@ -166,6 +177,22 @@ int main(int argc, char **argv)
mb->tag_get_handle("PARALLEL_PARTITION", 1, MB_TYPE_INTEGER,
part_tag, MB_TAG_CREAT|MB_TAG_SPARSE, &dum_id);
+ // create tags on vertices and cells, look in the list of options
+ vector<Tag> intTags(intTagNames.size());
+ vector<Tag> doubleTags(doubleTagNames.size());
+ for (size_t i=0; i<intTagNames.size(); i++)
+ {
+ rval = mb->tag_get_handle(intTagNames[i].c_str(), 1, MB_TYPE_INTEGER, intTags[i],
+ MB_TAG_CREAT|MB_TAG_DENSE, &dum_id);
+ CHECKE("Can't create integer tag.");
+ }
+ double defval=0.;
+ for (size_t i=0; i<doubleTagNames.size(); i++)
+ {
+ rval = mb->tag_get_handle(doubleTagNames[i].c_str(), 1, MB_TYPE_DOUBLE, doubleTags[i],
+ MB_TAG_CREAT|MB_TAG_DENSE, &defval);
+ CHECKE("Can't create double tag.");
+ }
for (int a=0; a<A; a++)
{
for (int b=0; b<B; b++)
@@ -199,6 +226,13 @@ int main(int argc, char **argv)
arrays[1][ix] = (double)y+jj;
arrays[2][ix] = (double)z+kk;
gids[ix] = 1 + (x+ii) + (y+jj) * NX + (z+kk) * (NX*NY) ;
+ // set int tags, some nice values?
+ EntityHandle v = startv + ix;
+ for (size_t i=0; i<intTags.size(); i++)
+ {
+ int valv=gids[ix]/2+3 + i*1000;
+ mb->tag_set_data(intTags[i], &v, 1, &valv);
+ }
ix++;
}
}
@@ -232,7 +266,15 @@ int main(int argc, char **argv)
{
EntityHandle corner=startv + q * ii + q * jj * ystride + q * kk * zstride;
gids[ie] = 1 + (xe+ii) + (ye+jj) * nex + (ze+kk) * (nex*ney) ;
+
+ EntityHandle eh = starte + ie;
ie++;
+ for (size_t i=0; i<doubleTags.size(); i++)
+ {
+ double valv=gids[ie]/30. + i*5000.;
+ mb->tag_set_data(doubleTags[i], &eh, 1, &valv);
+ }
+
if (quadratic)
{
@@ -320,9 +362,9 @@ int main(int argc, char **argv)
tt = clock();
}
- // before merge locally
+ /*// before merge locally
rval = mb->write_file("test0.h5m", 0, ";;PARALLEL=WRITE_PART");
- CHECKE("Can't write in parallel, before merging");
+ CHECKE("Can't write in parallel, before merging");*/
// after the mesh is generated on each proc, merge the vertices
MergeMesh mm(mb);
Range allhexas;
https://bitbucket.org/fathomteam/moab/commits/f2798929e89a/
Changeset: f2798929e89a
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: introduce ParallelComm::delete_entities(Range &)
when a user deletes an entity, in a parallel environment,
it needs to make sure it is deleted from all tasks that might
share it
Also, update the sharedEnts local vector on each
Affected #: 3 files
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 08dad08..8e5e029 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -408,18 +408,12 @@ int main(int argc, char **argv)
Range toDelete;
rval = mb->get_entities_by_dimension(0, 1, toDelete);
CHECKE("Can't get edges");
- rval = mb->delete_entities(toDelete);
- CHECKE("Can't delete edges");
-
- toDelete.clear();
rval = mb->get_entities_by_dimension(0, 2, toDelete);
CHECKE("Can't get faces");
- rval = mb->delete_entities(toDelete);
- CHECKE("Can't delete faces");
- rval = pcomm->correct_shared_entities() ;
- CHECKE("Can't correct local shared")
+ rval = pcomm->delete_entities(toDelete) ;
+ CHECKE("Can't delete entities")
if (0==rank)
{
diff --git a/src/parallel/ParallelComm.cpp b/src/parallel/ParallelComm.cpp
index a8571af..37f2813 100644
--- a/src/parallel/ParallelComm.cpp
+++ b/src/parallel/ParallelComm.cpp
@@ -8790,19 +8790,75 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
return MB_SUCCESS;
// end copy
}
-ErrorCode ParallelComm::correct_shared_entities()
+ErrorCode ParallelComm::delete_entities(Range & to_delete)
{
+ // will not look at shared sets yet, but maybe we should
+ // first, see if any of the entities to delete is shared; then inform the other processors
+ // about their fate (to be deleted), using a crystal router transfer
+ ErrorCode rval=MB_SUCCESS;
+ unsigned char pstat;
+ EntityHandle tmp_handles[MAX_SHARING_PROCS];
+ int tmp_procs[MAX_SHARING_PROCS];
+ unsigned int num_ps;
+ TupleList ents_to_delete;
+ ents_to_delete.initialize(1, 0, 1, 0, to_delete.size() * (MAX_SHARING_PROCS+1) );// a little bit of overkill
+ ents_to_delete.enableWriteAccess();
+ unsigned int i = 0;
+ for (Range::iterator it=to_delete.begin(); it!=to_delete.end(); it++)
+ {
+ EntityHandle eh=*it; // entity to be deleted
+
+ rval = get_sharing_data(eh, tmp_procs, tmp_handles,
+ pstat, num_ps);
+ if (rval!=MB_SUCCESS || num_ps==0)
+ continue;
+ // add to the tuple list the information to be sent (to the remote procs)
+
+ for (unsigned int p = 0; p < num_ps; p++)
+ {
+ ents_to_delete.vi_wr[i] = tmp_procs[p];
+ ents_to_delete.vul_wr[i] = (unsigned long)tmp_handles[p];
+ i++;
+ ents_to_delete.inc_n();
+ }
+ }
+
+ gs_data::crystal_data *cd = this->procConfig.crystal_router();
+ // all communication happens here; no other mpi calls
+ // also, this is a collective call
+ rval = cd->gs_transfer(1,ents_to_delete,0);
+
+ if (MB_SUCCESS!= rval)
+ {
+ std::cout << "error in tuple transfer\n";
+ return rval;
+ }
+ // add to the range of ents to delete the new ones that were sent from other procs
+ unsigned int received = ents_to_delete.get_n();
+ for (i=0; i< received; i++)
+ {
+ //int from = ents_to_delete.vi_rd[i];
+ unsigned long valrec = ents_to_delete.vul_rd[i];
+ to_delete.insert((EntityHandle)valrec);
+ }
+ rval = mbImpl->delete_entities(to_delete);
+ if (MB_SUCCESS!= rval)
+ {
+ std::cout << "error in deleting actual entities\n";
+ return rval;
+ }
std::vector<EntityHandle> good_ents;
- for (size_t i=0; i<sharedEnts.size(); i++)
+ for (size_t j=0; j<sharedEnts.size(); j++)
{
- if (mbImpl->is_valid(sharedEnts[i]))
+ if (mbImpl->is_valid(sharedEnts[j]))
{
- good_ents.push_back(sharedEnts[i]);
+ good_ents.push_back(sharedEnts[j]);
}
}
sharedEnts = good_ents;
+ // what about shared sets? who is updating them?
return MB_SUCCESS;
}
diff --git a/src/parallel/moab/ParallelComm.hpp b/src/parallel/moab/ParallelComm.hpp
index 2a16ac2..976236e 100644
--- a/src/parallel/moab/ParallelComm.hpp
+++ b/src/parallel/moab/ParallelComm.hpp
@@ -932,11 +932,11 @@ namespace moab {
ErrorCode settle_intersection_points(Range & edges, Range & shared_edges_owned,
std::vector<std::vector<EntityHandle> *> & extraNodesVec, double tolerance);
- /* \brief check the shared entities if they exist anymore
+ /* \brief delete entities from moab database
* will check the shared ents array, and clean it if necessary
*
*/
- ErrorCode correct_shared_entities();
+ ErrorCode delete_entities(Range & to_delete);
private:
https://bitbucket.org/fathomteam/moab/commits/82d8da7a24b2/
Changeset: 82d8da7a24b2
Branch: None
User: iulian07
Date: 2014-07-10 05:30:01
Summary: add the option to keep the skins
these skins result from resolving shared entities
we may want to keep them
By default, we delete them
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 8e5e029..ce67ac9 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -65,6 +65,7 @@ int main(int argc, char **argv)
bool newMergeMethod=false;
bool quadratic=false;
+ bool keep_skins=false;
MPI_Init(&argc, &argv);
@@ -92,6 +93,9 @@ int main(int argc, char **argv)
opts.addOpt<void>("quadratic,q", "use hex 27 elements",
&quadratic);
+ opts.addOpt<void>("keep_skins,k", "keep skins with shared entities",
+ &keep_skins);
+
vector<string> intTagNames;
string firstIntTag;
opts.addOpt<string>(std::string("int_tag_vert,i"), string("add integer tag on vertices"), &firstIntTag);
@@ -404,22 +408,25 @@ int main(int argc, char **argv)
tt = clock();
}
- // delete all quads and edges
- Range toDelete;
- rval = mb->get_entities_by_dimension(0, 1, toDelete);
- CHECKE("Can't get edges");
+ if (!keep_skins) // default is to delete the 1- and 2-dimensional entities
+ {
+ // delete all quads and edges
+ Range toDelete;
+ rval = mb->get_entities_by_dimension(0, 1, toDelete);
+ CHECKE("Can't get edges");
- rval = mb->get_entities_by_dimension(0, 2, toDelete);
- CHECKE("Can't get faces");
+ rval = mb->get_entities_by_dimension(0, 2, toDelete);
+ CHECKE("Can't get faces");
- rval = pcomm->delete_entities(toDelete) ;
- CHECKE("Can't delete entities")
+ rval = pcomm->delete_entities(toDelete) ;
+ CHECKE("Can't delete entities")
- if (0==rank)
- {
- std::cout << "delete edges and faces, and correct sharedEnts: "
- << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
- tt = clock();
+ if (0==rank)
+ {
+ std::cout << "delete edges and faces, and correct sharedEnts: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
}
rval = mb->write_file("test1.h5m", 0, ";;PARALLEL=WRITE_PART");
https://bitbucket.org/fathomteam/moab/commits/6bce0072ae38/
Changeset: 6bce0072ae38
Branch: iulian07/largemesh
User: iulian07
Date: 2014-07-10 05:30:01
Summary: add tetra option
also, add option for output file, default was test1.h5m
tetra does not work with quadratic yet, but it will someday
I mean, the tetras are all linear right now.
if -q and -t are used together, quadratic hexas will be generated
Affected #: 1 file
diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index ce67ac9..5918a09 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -7,6 +7,7 @@
* Each processor will create its version of a block mesh, partitioned
* as AxBxC blocks. Each block will be with blockSize^3 hexahedrons, and will get a
* different PARALLEL_PARTITION tag
+ * When -t option is used, instead of each hex, we are creating 6 tetrahedrons
*
* The number of tasks will be MxNxK, and it must match the mpi size
* Each task will generate its mesh at location (m,n,k)
@@ -14,7 +15,7 @@
* By default M=1, N=1, K=1, so by default it should be launched on 1 proc
* By default, blockSize is 4, and A=2, B=2, C=2, so each task will generate locally
* blockSize^3 x A x B x C hexahedrons (value = 64x8 = 512 hexas, in 8 partitions)
- *
+ * (if -t, multiple by 6 for total number of cells/tets)
* The total number of partitions will be A*B*C*M*N*K (default 8)
*
* Each part in partition will get a proper tag
@@ -41,6 +42,8 @@
* so you can launch with
* mpiexec -np 8 ./GenLargeMesh -M 2 -N 2 -K 2
*
+ * We also added -q option; it works now only for hexa mesh, it will generate
+ * quadratic hex27 elements
*/
#include "moab/Core.hpp"
@@ -66,6 +69,7 @@ int main(int argc, char **argv)
bool newMergeMethod=false;
bool quadratic=false;
bool keep_skins=false;
+ bool tetra = false;
MPI_Init(&argc, &argv);
@@ -96,6 +100,9 @@ int main(int argc, char **argv)
opts.addOpt<void>("keep_skins,k", "keep skins with shared entities",
&keep_skins);
+ opts.addOpt<void>("tetrahedrons,t", "generate tetrahedrons ",
+ &tetra);
+
vector<string> intTagNames;
string firstIntTag;
opts.addOpt<string>(std::string("int_tag_vert,i"), string("add integer tag on vertices"), &firstIntTag);
@@ -104,6 +111,9 @@ int main(int argc, char **argv)
string firstDoubleTag;
opts.addOpt<string>(std::string("double_tag_cell,d"), string("add double tag on cells"), &firstDoubleTag);
+ string outFileName="test1.h5m";
+ opts.addOpt<std::string> ("outFile,o", "Specify the output file name string (default test1.h5m)", &outFileName );
+
opts.parseCommandLine(argc, argv);
opts.getOptAllArgs("int_tag_vert,i", intTagNames);
@@ -159,6 +169,9 @@ int main(int argc, char **argv)
{
q = 2;
}
+ int factor =1;
+ if (tetra)
+ factor =6;
int NX = (q * M * A * blockSize + 1);
int NY = (q * N * B * blockSize + 1);
int nex = M * A * blockSize; // number of elements in x direction, used for global id on element
@@ -243,24 +256,26 @@ int main(int argc, char **argv)
}
mb->tag_set_data(global_id_tag, verts, &gids[0]);
int num_hexas = (blockSize)*(blockSize)*(blockSize);
+ int num_el = num_hexas * factor;
+
EntityHandle starte; // connectivity
EntityHandle * conn;
if (quadratic)
- {
- rval = iface->get_element_connect(num_hexas, 27, MBHEX, 0, starte, conn);
- }
+ rval = iface->get_element_connect(num_el, 27, MBHEX, 0, starte, conn);
+ else if (tetra)
+ rval = iface->get_element_connect(num_el, 4, MBTET, 0, starte, conn);
else
- rval = iface->get_element_connect(num_hexas, 8, MBHEX, 0, starte, conn);
- CHECKE("Can't get hexa connectivity.");
+ rval = iface->get_element_connect(num_el, 8, MBHEX, 0, starte, conn);
+ CHECKE("Can't get element connectivity.");
- Range hexas(starte, starte+num_hexas-1);
+ Range hexas(starte, starte+num_el-1); // should be elements
// fill hexas
ix=0;
// identify the elements at the lower corner, for their global ids
int xe = m*A*blockSize + a*blockSize;
int ye = n*B*blockSize + b*blockSize;
int ze = k*C*blockSize + c*blockSize;
- gids.resize(num_hexas);
+ gids.resize(num_el);
int ie=0; // index now in the elements, for global ids
for (int kk=0; kk<blockSize; kk++)
{
@@ -269,16 +284,15 @@ int main(int argc, char **argv)
for (int ii=0; ii<blockSize; ii++)
{
EntityHandle corner=startv + q * ii + q * jj * ystride + q * kk * zstride;
- gids[ie] = 1 + (xe+ii) + (ye+jj) * nex + (ze+kk) * (nex*ney) ;
+ gids[ie] = 1 + ((xe+ii) + (ye+jj) * nex + (ze+kk) * (nex*ney))*factor ; // 6 more for tetra
EntityHandle eh = starte + ie;
- ie++;
for (size_t i=0; i<doubleTags.size(); i++)
{
double valv=gids[ie]/30. + i*5000.;
mb->tag_set_data(doubleTags[i], &eh, 1, &valv);
}
-
+ ie++;
if (quadratic)
{
@@ -327,7 +341,73 @@ int main(int argc, char **argv)
conn[ix+26]= corner + 1 + ystride + zstride; // center
ix+=27;
}
- else
+ else if (tetra)
+ {
+
+ // E H
+ // F G
+ //
+ // A D
+ // B C
+ EntityHandle AA = corner;
+ EntityHandle BB = corner + 1;
+ EntityHandle CC = corner + 1 + ystride;
+ EntityHandle D = corner + ystride;
+ EntityHandle E = corner + zstride;
+ EntityHandle F = corner + 1 + zstride;
+ EntityHandle G = corner + 1 + ystride + zstride;
+ EntityHandle H = corner + ystride + zstride;
+
+ // tet EDHG
+ conn[ix] = E;
+ conn[ix+1] = D;
+ conn[ix+2] = H;
+ conn[ix+3] = G;
+
+ // tet ABCF
+ conn[ix+4] = AA;
+ conn[ix+5] = BB;
+ conn[ix+6] = CC;
+ conn[ix+7] = F;
+
+ // tet ADEF
+ conn[ix+8] = AA;
+ conn[ix+9] = D;
+ conn[ix+10] = E;
+ conn[ix+11] = F;
+
+ // tet CGDF
+ conn[ix+12] = CC;
+ conn[ix+13] = G;
+ conn[ix+14] = D;
+ conn[ix+15] = F;
+
+ // tet ACDF
+ conn[ix+16] = AA;
+ conn[ix+17] = CC;
+ conn[ix+18] = D;
+ conn[ix+19] = F;
+
+ // tet DGEF
+ conn[ix+20] = D;
+ conn[ix+21] = G;
+ conn[ix+22] = E;
+ conn[ix+23] = F;
+ ix+=24;
+ for (int ff=0; ff<factor-1; ff++)
+ {
+ gids[ie] = gids[ie-1]+1 ; // 6 more for tetra
+
+ eh = starte + ie;
+ for (size_t i=0; i<doubleTags.size(); i++)
+ {
+ double valv=gids[ie]/30. + i*5000.;
+ mb->tag_set_data(doubleTags[i], &eh, 1, &valv);
+ }
+ ie++;
+ }
+ }
+ else // linear hex
{
conn[ix]= corner;
conn[ix+1]=corner + 1;
@@ -371,10 +451,10 @@ int main(int argc, char **argv)
CHECKE("Can't write in parallel, before merging");*/
// after the mesh is generated on each proc, merge the vertices
MergeMesh mm(mb);
- Range allhexas;
- rval = mb->get_entities_by_type(0, MBHEX, allhexas);
+ Range all3dcells;
+ rval = mb->get_entities_by_dimension(0, 3, all3dcells);
- CHECKE("Can't get all hexa elements.");
+ CHECKE("Can't get all 3d cells elements.");
Range verts;
rval = mb->get_entities_by_dimension(0, 0, verts);
@@ -384,7 +464,7 @@ int main(int argc, char **argv)
if (newMergeMethod)
rval = mm.merge_using_integer_tag( verts, global_id_tag);
else
- rval = mm.merge_entities(allhexas, 0.0001);
+ rval = mm.merge_entities(all3dcells, 0.0001);
CHECKE("Can't merge");
if (0==rank)
{
@@ -398,7 +478,7 @@ int main(int argc, char **argv)
{
pcomm = new ParallelComm( mb, MPI_COMM_WORLD );
}
- rval = pcomm->resolve_shared_ents( 0, allhexas, 3, 0 );
+ rval = pcomm->resolve_shared_ents( 0, all3dcells, 3, 0 );
CHECKE("Can't resolve shared ents");
if (0==rank)
@@ -429,12 +509,12 @@ int main(int argc, char **argv)
}
}
- rval = mb->write_file("test1.h5m", 0, ";;PARALLEL=WRITE_PART");
+ rval = mb->write_file(outFileName.c_str(), 0, ";;PARALLEL=WRITE_PART");
CHECKE("Can't write in parallel");
if (0==rank)
{
- std::cout << "write file test1.h5m in parallel "
+ std::cout << "write file " << outFileName << " in "
<< (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
tt = clock();
}
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.
1
0
09 Jul '14
STATUS: Failure
1
0
commit/MOAB: danwu: Adding example to simulate MOAB's enhanced error handling in parallel. All of the errors are contrived, used for simulation purpose only.
by commits-noreply@bitbucket.org 09 Jul '14
by commits-noreply@bitbucket.org 09 Jul '14
09 Jul '14
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/6917d60bfb59/
Changeset: 6917d60bfb59
Branch: danwu/error_handling_enhancement
User: danwu
Date: 2014-07-09 22:04:17
Summary: Adding example to simulate MOAB's enhanced error handling in parallel. All of the errors are contrived, used for simulation purpose only.
Affected #: 2 files
diff --git a/examples/ErrorHandlingSimulation.cpp b/examples/ErrorHandlingSimulation.cpp
new file mode 100644
index 0000000..ffdc831
--- /dev/null
+++ b/examples/ErrorHandlingSimulation.cpp
@@ -0,0 +1,100 @@
+/** @example ErrorHandlingSimulation.cpp
+ * Description: This example simulates MOAB's enhanced error handling in parallel. \n
+ * All of the errors are contrived, used for simulation purpose only. \n
+ *
+ * <b>To run</b>: mpiexec -np 4 ./ErrorHandlingSimulation <test_case_num(1 to 4)> \n
+ */
+
+#include "moab/ErrorHandler.hpp"
+#ifdef USE_MPI
+#include "moab_mpi.h"
+#endif
+
+#include <iostream>
+#include <stdlib.h>
+
+using namespace moab;
+using namespace std;
+
+// Functions that create and handle contrived errors
+// Call hierarchy: A calls B, and B calls C
+ErrorCode FunctionC(int test_case_num, int rank)
+{
+ switch (test_case_num) {
+ case 1:
+ // Simulate a global fatal error MB_NOT_IMPLEMENTED on all processors
+ // Note, it is printed by root processor 0 only
+ SET_GLB_ERR(MB_NOT_IMPLEMENTED, "A contrived global error MB_NOT_IMPLEMENTED");
+ break;
+ case 2:
+ // Simulate a per-processor relevant error MB_INDEX_OUT_OF_RANGE on all processors
+ // Note, it is printed by all processors
+ SET_ERR_STR(MB_INDEX_OUT_OF_RANGE, "A contrived error MB_INDEX_OUT_OF_RANGE on processor " << rank);
+ break;
+ case 3:
+ // Simulate a per-processor relevant error MB_TYPE_OUT_OF_RANGE on all processors except root
+ // Note, it is printed by all non-root processors
+ if (0 != rank)
+ SET_ERR_STR(MB_TYPE_OUT_OF_RANGE, "A contrived error MB_TYPE_OUT_OF_RANGE on processor " << rank);
+ break;
+ case 4:
+ // Simulate a per-processor relevant error MB_INDEX_OUT_OF_RANGE on processor 1
+ // Note, it is printed by processor 1 only
+ if (1 == rank)
+ SET_ERR(MB_INDEX_OUT_OF_RANGE, "A contrived error MB_INDEX_OUT_OF_RANGE on processor 1");
+
+ // Simulate a per-processor relevant error MB_TYPE_OUT_OF_RANGE on processor 3
+ // Note, it is printed by processor 3 only
+ if (3 == rank)
+ SET_ERR(MB_TYPE_OUT_OF_RANGE, "A contrived error MB_TYPE_OUT_OF_RANGE on processor 3");
+ break;
+ default:
+ break;
+ }
+
+ return MB_SUCCESS;
+}
+
+ErrorCode FunctionB(int test_case_num, int rank)
+{
+ ErrorCode err_code = FunctionC(test_case_num, rank);CHK_ERR(err_code);
+
+ return MB_SUCCESS;
+}
+
+ErrorCode FunctionA(int test_case_num, int rank)
+{
+ ErrorCode err_code = FunctionB(test_case_num, rank);CHK_ERR(err_code);
+
+ return MB_SUCCESS;
+}
+
+int main(int argc, char** argv)
+{
+ if (argc < 2) {
+ cout << "Usage: " << argv[0] << " <test_case_num(1 to 4)>" << endl;
+ return 0;
+ }
+
+#ifdef USE_MPI
+ MPI_Init(&argc, &argv);
+#endif
+
+ MBErrorHandler_Init();
+
+ int test_case_num = atoi(argv[1]);
+ int rank = 0;
+#ifdef USE_MPI
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+#endif
+
+ ErrorCode rval = FunctionA(test_case_num, rank);CHK_ERR(rval);
+
+ MBErrorHandler_Finalize();
+
+#ifdef USE_MPI
+ MPI_Finalize();
+#endif
+
+ return 0;
+}
diff --git a/examples/makefile b/examples/makefile
index 787c8d3..c4dd9e7 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -11,8 +11,9 @@ EXAMPLES = HelloMOAB GetEntities SetsNTags LoadPartial structuredmesh Structured
PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation CrystalRouterExample
EXOIIEXAMPLES = TestExodusII
F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
+ERROREXAMPLES = ErrorHandlingSimulation
-default: ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
+default: ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES} ${ERROREXAMPLES}
HelloMOAB: HelloMOAB.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
@@ -70,9 +71,12 @@ VisTags: VisTags.o ${MOAB_LIBDIR}/libMOAB.la
ReadWriteTest: ReadWriteTest.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
-
+
+ErrorHandlingSimulation: ErrorHandlingSimulation.o ${MOAB_LIBDIR}/libMOAB.la
+ ${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
clean:
- rm -rf *.o *.mod *.h5m ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
+ rm -rf *.o *.mod *.h5m ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES} ${ERROREXAMPLES}
.cpp.o:
${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_CPPFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
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.
1
0
commit/MOAB: danwu: Framework code for enhanced error handling.
by commits-noreply@bitbucket.org 09 Jul '14
by commits-noreply@bitbucket.org 09 Jul '14
09 Jul '14
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/04229f2f1c6f/
Changeset: 04229f2f1c6f
Branch: danwu/error_handling_enhancement
User: danwu
Date: 2014-07-09 20:20:20
Summary: Framework code for enhanced error handling.
Affected #: 6 files
diff --git a/src/ErrorHandler.cpp b/src/ErrorHandler.cpp
new file mode 100644
index 0000000..9f0fdee
--- /dev/null
+++ b/src/ErrorHandler.cpp
@@ -0,0 +1,75 @@
+#include "moab/ErrorHandler.hpp"
+#include "ErrorOutput.hpp"
+#ifdef USE_MPI
+#include "moab_mpi.h"
+#endif
+
+#include <stdlib.h>
+
+namespace moab {
+
+static ErrorOutput* errorOutput = NULL;
+
+void MBErrorHandler_Init()
+{
+ if (NULL == errorOutput) {
+ errorOutput = new ErrorOutput(stderr);
+ errorOutput->use_world_rank();
+ }
+}
+
+void MBErrorHandler_Finalize()
+{
+ if (NULL != errorOutput) {
+ delete errorOutput;
+ errorOutput = NULL;
+ }
+}
+
+bool MBErrorHandler_Initialized()
+{
+ return (NULL != errorOutput);
+}
+
+void MBTraceBackErrorHandler(int line, const char* func, const char* file, const char* dir, const char* err_msg, ErrorType err_type)
+{
+ // For a globally fatal error, get world rank of current processor, so that it is only printed from processor 0
+ // For a per-processor relevant error, set rank of current processor to 0, so that it is always printed
+ int rank = 0;
+ if (MB_ERROR_TYPE_NEW_GLOBAL == err_type && NULL != errorOutput && errorOutput->have_rank())
+ rank = errorOutput->get_rank();
+
+ if (0 == rank) {
+ // Print the error messages if it is a new error
+ if (MB_ERROR_TYPE_EXISTING != err_type && NULL != errorOutput && NULL != err_msg) {
+ errorOutput->print("--------------------- Error Message ------------------------------------\n");
+ errorOutput->printf("%s!\n", err_msg);
+ }
+
+ // Print a line of stack trace
+ if (NULL != errorOutput)
+ errorOutput->printf("%s() line %d in %s%s\n", func, line, dir, file);
+ }
+ else {
+ // Do not print the error messages, since processor 0 will print them
+ // Sleep 10 seconds before aborting so it will not accidently kill process 0
+ sleep(10);
+ abort();
+ }
+}
+
+ErrorCode MBError(int line, const char* func, const char* file, const char* dir, ErrorCode err_code, const char* err_msg, ErrorType err_type)
+{
+ MBTraceBackErrorHandler(line, func, file, dir, err_msg, err_type);
+
+#ifdef USE_MPI
+ // If this is called from the main() routine we call MPI_Abort() to allow
+ // the parallel program to be properly shutdown
+ if (strncmp(func, "main", 4) == 0)
+ MPI_Abort(MPI_COMM_WORLD, err_code);
+#endif
+
+ return err_code;
+}
+
+} // namespace moab
diff --git a/src/ErrorOutput.cpp b/src/ErrorOutput.cpp
new file mode 100644
index 0000000..e71e010
--- /dev/null
+++ b/src/ErrorOutput.cpp
@@ -0,0 +1,169 @@
+#include "ErrorOutput.hpp"
+
+#include <iostream>
+#include <string.h>
+#include <algorithm>
+#include <assert.h>
+
+#ifdef USE_MPI
+#include "moab_mpi.h"
+#endif
+
+namespace moab {
+
+class FILEErrorStream : public ErrorOutputStream
+{
+private:
+ FILE* filePtr;
+
+public:
+ FILEErrorStream(FILE* filep) : filePtr(filep) {}
+ void println(int rank, const char* str);
+ void println(const char* str);
+};
+
+void FILEErrorStream::println(int rank, const char* str)
+{
+ fprintf(filePtr, "[%d]MOAB ERROR: %s\n", rank, str);
+ fflush(filePtr);
+}
+
+void FILEErrorStream::println(const char* str)
+{
+ fprintf(filePtr, "MOAB ERROR: %s\n", str);
+ fflush(filePtr);
+}
+
+class CxxErrorStream : public ErrorOutputStream
+{
+private:
+ std::ostream& outStr;
+
+public:
+ CxxErrorStream(std::ostream& str) : outStr(str) {}
+ void println(int rank, const char* str);
+ void println(const char* str);
+};
+
+void CxxErrorStream::println(int rank, const char* str)
+{
+ outStr << "[" << rank << "]MOAB ERROR: " << str << std::endl;
+ outStr.flush();
+}
+
+void CxxErrorStream::println(const char* str)
+{
+ outStr << "MOAB ERROR: " << str << std::endl;
+ outStr.flush();
+}
+
+ErrorOutput::ErrorOutput(FILE* impl)
+ : outputImpl(new FILEErrorStream(impl)),
+ mpiRank(-1)
+{
+ lineBuffer.reserve(1024);
+}
+
+ErrorOutput::ErrorOutput(std::ostream& str)
+ : outputImpl(new CxxErrorStream(str)),
+ mpiRank(-1)
+{
+ lineBuffer.reserve(1024);
+}
+
+ErrorOutput::~ErrorOutput()
+{
+ if (!lineBuffer.empty()) {
+ lineBuffer.push_back('\n');
+ process_line_buffer();
+ }
+
+ if (NULL != outputImpl) {
+ delete outputImpl;
+ outputImpl = NULL;
+ }
+}
+
+void ErrorOutput::use_world_rank()
+{
+#ifdef USE_MPI
+ int flag1;
+ MPI_Initialized(&flag1);
+ int flag2;
+ MPI_Finalized(&flag2);
+ if (flag1 && !flag2)
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
+#endif
+}
+
+void ErrorOutput::print_real(const char* buffer)
+{
+ lineBuffer.insert(lineBuffer.end(), buffer, buffer + strlen(buffer));
+ process_line_buffer();
+}
+
+void ErrorOutput::print_real(const std::string& str)
+{
+ lineBuffer.insert(lineBuffer.end(), str.begin(), str.end());
+ process_line_buffer();
+}
+
+void ErrorOutput::print_real(const char* fmt, va_list args1, va_list args2)
+{
+ size_t idx = lineBuffer.size();
+#ifdef HAVE_VSNPRINTF
+ // try once with remaining space in buffer
+ lineBuffer.resize(lineBuffer.capacity());
+ unsigned size = vsnprintf(&lineBuffer[idx], lineBuffer.size() - idx, fmt, args1);
+ ++size; // trailing null
+ // if necessary, increase buffer size and retry
+ if (size > (lineBuffer.size() - idx)) {
+ lineBuffer.resize(idx + size);
+ size = vsnprintf(&lineBuffer[idx], lineBuffer.size() - idx, fmt, args2);
+ ++size; // trailing null
+ }
+#else
+ // Guess how much space might be required.
+ // If every character is a format code then there are len/3 format codes.
+ // Guess a random large value of 81 characters per formatted argument.
+ unsigned exp_size = 27 * strlen(fmt);
+ lineBuffer.resize(idx + exp_size);
+ unsigned size = vsprintf(&lineBuffer[idx], fmt, args1);
+ ++size; // trailing null
+ // check if we overflowed the buffer
+ if (size > exp_size) {
+ // crap!
+ fprintf(stderr, "ERROR: Buffer overflow at %s:%d\n", __FILE__, __LINE__);
+ lineBuffer.resize(idx + exp_size);
+ size = vsprintf(&lineBuffer[idx], fmt, args2);
+ ++size; // trailing null
+ }
+#endif
+
+ // less one because we don't want the trailing '\0'
+ lineBuffer.resize(idx + size - 1);
+ process_line_buffer();
+}
+
+void ErrorOutput::process_line_buffer()
+{
+ size_t last_idx = 0;
+ std::vector<char>::iterator i;
+ for (i = std::find(lineBuffer.begin(), lineBuffer.end(), '\n');
+ i != lineBuffer.end(); i = std::find(i, lineBuffer.end(), '\n')) {
+ *i = '\0';
+ if (have_rank())
+ outputImpl->println(get_rank(), &lineBuffer[last_idx]);
+ else
+ outputImpl->println(&lineBuffer[last_idx]);
+ ++i;
+ last_idx = i - lineBuffer.begin();
+ }
+
+ if (last_idx) {
+ i = std::copy(lineBuffer.begin() + last_idx, lineBuffer.end(), lineBuffer.begin());
+ lineBuffer.erase(i, lineBuffer.end());
+ }
+}
+
+} // namespace moab
diff --git a/src/ErrorOutput.hpp b/src/ErrorOutput.hpp
new file mode 100644
index 0000000..cd9a03e
--- /dev/null
+++ b/src/ErrorOutput.hpp
@@ -0,0 +1,101 @@
+#ifndef moab_ERROR_OUTPUT_HPP
+#define moab_ERROR_OUTPUT_HPP
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <vector>
+#include <iosfwd>
+#include <string>
+
+#include "moab/Compiler.hpp"
+
+namespace moab {
+
+class ErrorOutputStream;
+
+/**\brief Utility class for printing error output
+ *
+ * This class implements line-oriented output. That is, it buffers
+ * output data until a newline is encountered, at which point it
+ * sends the output to the output stream followed by an explicit
+ * flush, and optionally prefixed with the MPI rank.
+ *
+ * \Note Any output not terminated with an newline character or
+ * followed by later output containing a newline character
+ * will not be flushed until the destructor is invoked.
+ */
+class ErrorOutput {
+public:
+ /**
+ *\param str Output stream to which to flush output
+ */
+ ErrorOutput(FILE* str);
+
+ /**
+ *\param str Output stream to which to flush output
+ */
+ ErrorOutput(std::ostream& str);
+
+ /**
+ * Destructor flushes any remaining output that wasn't followed
+ * by a newline character.
+ */
+ ~ErrorOutput();
+
+ //!\brief Check if MPI rank has been set.
+ bool have_rank() const { return mpiRank >= 0; }
+ //!\brief Get MPI rank.
+ int get_rank() const { return mpiRank; }
+ //!\brief Set MPI rank.
+ void set_rank(int rank) { mpiRank = rank; }
+ //!\brief Set MPI rank to the rank of this process in MPI_COMM_WORLD,
+ //! if MOAB is built with MPI and MPI_Init has been called
+ void use_world_rank();
+
+ //!\brief Output the specified string
+ void print(const char* str) { print_real(str); }
+
+ //!\brief Output the specified string
+ void print(const std::string& str) { print_real(str); }
+
+ //!\brief Output the specified printf-formatted output
+ void printf(const char* fmt, ...) MB_PRINTF(1);
+
+private:
+ ErrorOutputStream* outputImpl;
+ int mpiRank;
+
+ void print_real(const char* buffer);
+ void print_real(const std::string& str);
+
+ // Function must be passed to copies of the same va_list because
+ // a) it might have to call vs(n)printf twice, b) vs(n)printf modifies
+ // the va_list such that it cannot be reused, and c) va_copy is not
+ // (yet) portable (c99, no c++ standard).
+ void print_real(const char* buffer, va_list args1, va_list args2);
+ void process_line_buffer();
+
+ std::vector<char> lineBuffer;
+};
+
+inline void ErrorOutput::printf(const char* fmt, ...)
+{
+ va_list args1, args2;
+ va_start(args1, fmt);
+ va_start(args2, fmt);
+ print_real(fmt, args1, args2);
+ va_end(args2);
+ va_end(args1);
+}
+
+class ErrorOutputStream {
+public:
+ ErrorOutputStream() {}
+ virtual ~ErrorOutputStream() {}
+ virtual void println(const char* str) = 0;
+ virtual void println(int rank, const char* str) = 0;
+};
+
+} // namespace moab
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index a9adf0d..f55d82c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,6 +56,9 @@ libMOAB_la_SOURCES = \
ElementSequence.hpp \
EntitySequence.cpp \
EntitySequence.hpp \
+ ErrorHandler.cpp \
+ ErrorOutput.cpp \
+ ErrorOutput.hpp \
Factory.cpp \
FBEngine.cpp \
FileOptions.cpp \
@@ -161,6 +164,7 @@ nobase_libMOAB_la_include_HEADERS = \
moab/HomXform.hpp \
moab/EntityType.hpp \
moab/EntityHandle.hpp \
+ moab/ErrorHandler.hpp \
moab/FBEngine.hpp \
moab/FileOptions.hpp \
moab/FindPtFuncs.h \
diff --git a/src/moab/ErrorHandler.hpp b/src/moab/ErrorHandler.hpp
new file mode 100644
index 0000000..ec91113
--- /dev/null
+++ b/src/moab/ErrorHandler.hpp
@@ -0,0 +1,144 @@
+#ifndef MOAB_ERROR_HANDLER_HPP
+#define MOAB_ERROR_HANDLER_HPP
+
+#include "moab/Types.hpp"
+
+#include <sstream>
+#include <string.h>
+
+namespace moab {
+
+//! ErrorType - passed to the error handling routines indicating if this is a new error (globally fatal
+//! or per-processor relevant) or an existing one
+enum ErrorType {MB_ERROR_TYPE_NEW_GLOBAL = 0, MB_ERROR_TYPE_NEW_LOCAL = 1, MB_ERROR_TYPE_EXISTING = 2};
+
+//! Initialize MOAB error handler (e.g. create a utility object for printing error output)
+void MBErrorHandler_Init();
+
+//! Finalize MOAB error handler (e.g. delete the utility object for printing error output)
+void MBErrorHandler_Finalize();
+
+//! Indicates whether MBErrorHandler_Init has been called
+bool MBErrorHandler_Initialized();
+
+//! Routine that is called when an error has been detected
+ErrorCode MBError(int line, const char* func, const char* file, const char* dir,
+ ErrorCode err_code, const char* err_msg, ErrorType err_type);
+
+#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#define MBSTRINGIFY_(X) #X
+#define MBSTRINGIFY(X) MBSTRINGIFY_(X)
+
+#ifdef LOCDIR
+#define __SDIR__ MBSTRINGIFY(LOCDIR)
+#else
+#define __SDIR__ ""
+#endif
+
+//! Set a new error with passed error code and passed error message string
+#define SET_ERR(err_code, err_msg) \
+ return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_code, err_msg, MB_ERROR_TYPE_NEW_LOCAL)
+
+//! Set a new error with passed error code and passed error message string stream
+#define SET_ERR_STR(err_code, err_msg_str) \
+ do { \
+ std::ostringstream ostr; \
+ ostr << err_msg_str; \
+ return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_code, ostr.str().c_str(), MB_ERROR_TYPE_NEW_LOCAL); \
+ } while (false)
+
+//! Set a new global error with passed error code and passed error message string
+#define SET_GLB_ERR(err_code, err_msg) \
+ return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_code, err_msg, MB_ERROR_TYPE_NEW_GLOBAL)
+
+//! Set a new global error with passed error code and passed error message string stream
+#define SET_GLB_ERR_STR(err_code, err_msg_str) \
+ do { \
+ std::ostringstream ostr; \
+ ostr << err_msg_str; \
+ return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_code, ostr.str().c_str(), MB_ERROR_TYPE_NEW_GLOBAL); \
+ } while (false)
+
+//! Check returned error code against MB_SUCCESS
+#define CHK_ERR(err_code) \
+ do { \
+ if (MB_SUCCESS != err_code) \
+ return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_code, "", MB_ERROR_TYPE_EXISTING); \
+ } while (false)
+
+//! Check returned error code against MB_SUCCESS
+//! Set a new error with the returned error code and passed error message string
+#define CHK_ERR1(err_code, err_msg_to_set) \
+ do { \
+ if (MB_SUCCESS != err_code) \
+ SET_ERR(err_code, err_msg_to_set); \
+ } while (false)
+
+//! Check returned error code against MB_SUCCESS
+//! Set a new error with the returned error code and passed error message string stream
+#define CHK_ERR1_STR(err_code, err_msg_str_to_set) \
+ do { \
+ if (MB_SUCCESS != err_code) \
+ SET_ERR_STR(err_code, err_msg_str_to_set); \
+ } while (false)
+
+//! Check returned error code against MB_SUCCESS
+//! Set a new error with passed error code and passed error message string
+#define CHK_ERR2(err_code, err_code_to_set, err_msg_to_set) \
+ do { \
+ if (MB_SUCCESS != err_code) \
+ SET_ERR(err_code_to_set, err_msg_to_set); \
+ } while (false)
+
+//! Check returned error code against MB_SUCCESS
+//! Set a new error with passed error code and passed error message string stream
+#define CHK_ERR2_STR(err_code, err_code_to_set, err_msg_str_to_set) \
+ do { \
+ if (MB_SUCCESS != err_code) \
+ SET_ERR_STR(err_code_to_set, err_msg_str_to_set); \
+ } while (false)
+
+//! Check returned error code against an expected one
+//! Set a new error with default error code and default error message string
+#define CHK_EQL(err_code, exp_err_code) \
+ do { \
+ if (exp_err_code != err_code) \
+ SET_ERR(MB_FAILURE, "Returned error code is not expected"); \
+ } while (false)
+
+//! Check returned error code against an expected one
+//! Set a new error with default error code and passed error message string
+#define CHK_EQL1(err_code, exp_err_code, err_msg_to_set) \
+ do { \
+ if (exp_err_code != err_code) { \
+ SET_ERR(MB_FAILURE, err_msg_to_set); \
+ } \
+ } while (false)
+
+//! Check returned error code against an expected one
+//! Set a new error with default error code and passed error message string stream
+#define CHK_EQL1_STR(err_code, exp_err_code, err_msg_str_to_set) \
+ do { \
+ if (exp_err_code != err_code) \
+ SET_ERR_STR(MB_FAILURE, err_msg_str_to_set); \
+ } while (false)
+
+//! Check returned error code against an expected one
+//! Set a new error with passed error code and passed error message string
+#define CHK_EQL2(err_code, exp_err_code, err_code_to_set, err_msg_to_set) \
+ do { \
+ if (exp_err_code != err_code) \
+ SET_ERR(err_code_to_set, err_msg_to_set); \
+ } while (false)
+
+//! Check returned error code against an expected one
+//! Set a new error with passed error code and passed error message string stream
+#define CHK_EQL2_STR(err_code, exp_err_code, err_code_to_set, err_msg_str_to_set) \
+ do { \
+ if (exp_err_code != err_code) \
+ SET_ERR_STR(err_code_to_set, err_msg_str_to_set); \
+ } while (false)
+#endif
+
+} // namespace moab
diff --git a/src/moab/Interface.hpp b/src/moab/Interface.hpp
index 09f4219..8ffe2a3 100644
--- a/src/moab/Interface.hpp
+++ b/src/moab/Interface.hpp
@@ -43,6 +43,7 @@
#include "moab/Forward.hpp"
#include "moab/Range.hpp"
#include "moab/Compiler.hpp"
+#include "moab/ErrorHandler.hpp"
// include files
#include <string>
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.
1
0