[MOAB-dev] commit/MOAB: nray: Added down adjacencies. Merged separate performance tests for AHF and
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jul 10 18:41:50 CDT 2014
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.
More information about the moab-dev
mailing list