[MOAB-dev] commit/MOAB: 16 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jun 19 13:08:30 CDT 2014
16 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/a1a091008b7b/
Changeset: a1a091008b7b
Branch: None
User: makeclean
Date: 2014-02-03 17:49:02
Summary: Merged fathomteam/moab into master
Affected #: 2 files
diff --git a/tools/mbcslam/diffusion.cpp b/tools/mbcslam/diffusion.cpp
index 378473e..be70cd6 100644
--- a/tools/mbcslam/diffusion.cpp
+++ b/tools/mbcslam/diffusion.cpp
@@ -397,17 +397,28 @@ ErrorCode compute_tracer_case1(Interface * mb, Intx2MeshOnSphere & worker, Entit
// if in parallel, we have to move some elements to another proc, and receive other cells
// from other procs
// lagr and euler are preserved
+ if (writeFiles) // so if need to write lagr files too
+ {
+
+ }
EntityHandle covering_set;
rval = worker.create_departure_mesh_3rd_alg(lagr_set, covering_set);
if (writeFiles) // so if write
{
+ std::stringstream departureMesh;
+ departureMesh << "Departure" << rank << "_" << tStep << ".vtk";
+ rval = mb->write_file(departureMesh.str().c_str(), 0, 0, &lagr_set, 1);
+ CHECK_ERR(rval);
+
std::stringstream newTracer;
newTracer << "Tracer" << rank << "_" << tStep << ".vtk";
rval = mb->write_file(newTracer.str().c_str(), 0, 0, &euler_set, 1);
+ CHECK_ERR(rval);
std::stringstream lagr_cover;
lagr_cover << "Cover" << rank << "_" << tStep << ".vtk";
rval = mb->write_file(lagr_cover.str().c_str(), 0, 0, &covering_set, 1);
+ CHECK_ERR(rval);
}
// so we have now the departure at the previous time
diff --git a/tools/mbcslam/intx_mpas.cpp b/tools/mbcslam/intx_mpas.cpp
index d737156..b3d49d9 100644
--- a/tools/mbcslam/intx_mpas.cpp
+++ b/tools/mbcslam/intx_mpas.cpp
@@ -22,6 +22,7 @@
#include "moab/ParallelComm.hpp"
#include "CslamUtils.hpp"
+#include <time.h>
#ifdef MESHDIR
std::string TestDir( STRINGIFY(MESHDIR) );
@@ -43,6 +44,7 @@ double radius = 1.;// in m: 6371220.
double t = 0.1, delta_t = 0.05; // check the script
bool Verbose = false;
+double rot= M_PI/10;
ErrorCode manufacture_lagrange_mesh_on_sphere(Interface * mb,
EntityHandle euler_set)
@@ -84,7 +86,7 @@ ErrorCode manufacture_lagrange_mesh_on_sphere(Interface * mb,
//int vix=0; // vertex index in new array
double T=5;// check the script
- double rot= M_PI/10;
+
for (Range::iterator vit=connecVerts.begin();vit!=connecVerts.end(); vit++ )
{
EntityHandle oldV=*vit;
@@ -152,12 +154,23 @@ int main(int argc, char **argv)
if (!strcmp(argv[index], "-FF"))
{
flux_form= true;
- index++;
}
if (!strcmp(argv[index], "-v"))
{
Verbose = true;
- index++;
+ }
+ if (!strcmp(argv[index], "-t"))
+ {
+ t = atof(argv[++index]);
+ }
+ if (!strcmp(argv[index], "-t"))
+ {
+ t = atof(argv[++index]);
+ }
+ if (!strcmp(argv[index], "-rot"))
+ {
+ rot = atof(argv[++index]);
+ rot = M_PI/rot; // so rot 50 means rotate with M_PI/50 radians
}
index++;
@@ -165,7 +178,7 @@ int main(int argc, char **argv)
}
// start copy
std::string opts = std::string("PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN")+
- std::string(";PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE=;")+extra_read_opts;
+ std::string(";PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE=;NO_EDGES;")+extra_read_opts;
Core moab;
Interface & mb = moab;
EntityHandle euler_set;
@@ -173,20 +186,30 @@ int main(int argc, char **argv)
rval = mb.create_meshset(MESHSET_SET, euler_set);
CHECK_ERR(rval);
+ clock_t tt = clock();
rval = mb.load_file(filename_mesh1, &euler_set, opts.c_str());
+ CHECK_ERR(rval);
ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
CHECK_ERR(rval);
- rval = pcomm->check_all_shared_handles();
- CHECK_ERR(rval);
+ /*rval = pcomm->check_all_shared_handles();
+ CHECK_ERR(rval);*/
// end copy
int rank = pcomm->proc_config().proc_rank();
+ int procs = pcomm->proc_config().proc_size();
if (0==rank)
std::cout << " case 1: use -gtol " << gtol << " -dt " << delta_t <<
- " -R " << radius << " -input " << filename_mesh1 << "\n";
+ " -R " << radius << " -input " << filename_mesh1 << " -t " << t << " -rot " << rot << "\n";
+
+ if (0==rank)
+ {
+ std::cout << "load mesh from " << filename_mesh1 << "\n on " << procs << " processors in "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
rval = manufacture_lagrange_mesh_on_sphere(&mb, euler_set);
if (MB_SUCCESS != rval)
@@ -208,11 +231,23 @@ int main(int argc, char **argv)
//double radius = 1.; // input
worker.SetRadius(radius);
-
+ if (0==rank)
+ {
+ std::cout << "manufacture departure mesh " << filename_mesh1 << "\n on " << procs << " processors in "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
worker.SetErrorTolerance(gtol);
rval = worker.create_departure_mesh_2nd_alg(euler_set, covering_lagr_set);
CHECK_ERR(rval);
+ if (0==rank)
+ {
+ std::cout << "communicate covering mesh on " << procs << " processors in "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
if (Verbose)
{
std::stringstream lagrIni;
@@ -240,8 +275,13 @@ int main(int argc, char **argv)
rval = worker.intersect_meshes(covering_lagr_set, euler_set, outputSet);
if (MB_SUCCESS != rval)
return 1;
-
- if (rank<=4)
+ if (0==rank)
+ {
+ std::cout << "intersect meshes in " << procs << " processors in "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+ if (Verbose && rank<=4)
{
std::string opts_write("");
std::stringstream outf;
@@ -250,11 +290,15 @@ int main(int argc, char **argv)
if (MB_SUCCESS != rval)
std::cout << "can't write output\n";
}
- double intx_area = area_on_sphere_lHuiller(&mb, outputSet, radius);
- double arrival_area = area_on_sphere_lHuiller(&mb, euler_set, radius);
- std::cout << " Arrival area: " << arrival_area
- << " intersection area:" << intx_area << " rel error: "
- << fabs((intx_area - arrival_area) / arrival_area) << "\n";
+
+ if (rank <= 4)
+ {
+ double intx_area = area_on_sphere_lHuiller(&mb, outputSet, radius);
+ double arrival_area = area_on_sphere_lHuiller(&mb, euler_set, radius);
+ std::cout << "On proc " << rank << " arrival area: " << arrival_area
+ << " intersection area:" << intx_area << " rel error: "
+ << fabs((intx_area - arrival_area) / arrival_area) << "\n";
+ }
MPI_Finalize();
if (MB_SUCCESS != rval)
https://bitbucket.org/fathomteam/moab/commits/2579d2d30915/
Changeset: 2579d2d30915
Branch: None
User: makeclean
Date: 2014-03-27 14:57:35
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 111 files
diff --git a/.gitignore b/.gitignore
index d842c2b..c80a80a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,12 +31,13 @@ doc/config.tex
doc/dev.dox
doc/user/*
doc/user.dox
-examples/examples.make
+examples/CrystalRouterExample
examples/DeformMeshRemap
examples/DirectAccessNoHoles
+examples/DirectAccessNoHolesF90
examples/DirectAccessWithHoles
-examples/FileRead
-examples/GeomSetHierarchy
+examples/examples.make
+examples/freem.mod
examples/GetEntities
examples/*.h5m
examples/HelloMOAB
@@ -46,14 +47,14 @@ examples/itaps/ListSetsNTagsCXX
examples/itaps/ListSetsNTagsF90
examples/itaps/TagIterateC
examples/itaps/TagIterateF
-examples/KDTree
-examples/ObbTree
+examples/LloydRelaxation
+examples/LoadPartial
+examples/point_in_elem_search
examples/PushParMeshIntoMoabF90
examples/ReduceExchangeTags
examples/SetsNTags
-examples/SkinMesh
+examples/structuredmesh
examples/StructuredMeshSimple
-examples/SurfArea
examples/TestExodusII
history??.jou
hpctoolkit-*
@@ -80,7 +81,6 @@ itaps/imesh/ScdMeshF77
itaps/imesh/ScdMeshF90
itaps/imesh/testc_cbind
*.la
-*.la
*.lai
lib
lib/*
@@ -130,13 +130,11 @@ test/cropvol_test
test/dual/dual_test
test/elem_eval_test
test/file_options_test
+test/*.h5m
test/*.g
-test/*.g
-test/*.gen
test/*.gen
test/geom_util_test
test/gttool_test
-test/gttool_test
test/h5file/dump_sets
test/h5file/h5legacy
test/h5file/h5partial
@@ -154,7 +152,10 @@ test/io/*.g
test/io/gmsh_test
test/io/ideas_test
test/io/nastran_test
+test/io/read_cgm_basic_test
+test/io/read_cgm_load_test
test/io/read_cgm_test
+test/io/read_mpas_nc
test/io/read_nc
test/io/read_ucd_nc
test/io/readutil_test
@@ -169,6 +170,7 @@ test/lloyd_smoother_test
test/mbcn_test
test/mbfacet_test
test/mbground_test
+test/mergemesh_test
test/mesh_set_test
test/moab_test
test/obb/obb_test
@@ -176,7 +178,6 @@ test/obb/obb_time
test/obb/obb_tree_tool
test/obb_test
test/oldinc/test_oldinc
-test/read_mpas_nc
test/parallel/*.h5m
test/parallel/mbparallelcomm_test
test/parallel/mhdf_parallel
@@ -188,6 +189,7 @@ test/parallel/parallel_unit_tests
test/parallel/parallel_write_test
test/parallel/par_coupler_test
test/parallel/par_intx_sph
+test/parallel/par_spatial_locator_test
test/parallel/parmerge
test/parallel/partcheck
test/parallel/pcomm_serial
@@ -208,6 +210,8 @@ test/perf/seqperf
test/perf/tstt_perf_binding
test/perf/point_location/elem_eval_time
test/perf/point_location/point_location
+test/perf/point_location/sploc_searching_perf
+test/perf/point_location/tree_searching_perf
test/range_test
test/reorder_test
test/scdseq_test
@@ -233,16 +237,25 @@ tools/mbconvert
tools/mbcoupler/*.h5m
tools/mbcoupler/*.g
tools/mbcoupler/tests/
+tools/mbcslam/advection
tools/mbcslam/case1_test
+tools/mbcslam/create_dp
+tools/mbcslam/cslam_par_test
+tools/mbcslam/diffusion
tools/mbcslam/intersect1.h5m
tools/mbcslam/intx1.vtk
+tools/mbcslam/intx_imesh
tools/mbcslam/intx_in_plane_test
+tools/mbcslam/intx_mpas
tools/mbcslam/intx_on_sphere_test
tools/mbcslam/intx.vtk
tools/mbcslam/lagr.h5m
+tools/mbcslam/lagrIni.h5m
tools/mbcslam/spectral.vtk
tools/mbcslam/spec_visu_test
tools/mbcslam/spherical_area_test
+tools/mbcslam/polyWithEdges.vtk
+tools/mbcslam/proj1
tools/mbdepth
tools/mbgsets
tools/mbmem
diff --git a/MeshFiles/unittest/dagmc/test_geom.h5m b/MeshFiles/unittest/dagmc/test_geom.h5m
new file mode 100644
index 0000000..18e1d36
Binary files /dev/null and b/MeshFiles/unittest/dagmc/test_geom.h5m differ
diff --git a/MeshFiles/unittest/io/Makefile.am b/MeshFiles/unittest/io/Makefile.am
index dbce393..3b767aa 100644
--- a/MeshFiles/unittest/io/Makefile.am
+++ b/MeshFiles/unittest/io/Makefile.am
@@ -5,6 +5,7 @@ EXTRA_DIST = HommeMapping.nc \
camEul26x48x96.t3.nc \
fv26x46x72.t.3.nc \
cubtest12.cub \
+ cubtest14.cub \
cubtest.jou \
dum.sat \
dum.stp \
diff --git a/MeshFiles/unittest/io/cube.sat b/MeshFiles/unittest/io/cube.sat
new file mode 100644
index 0000000..58fd508
--- /dev/null
+++ b/MeshFiles/unittest/io/cube.sat
@@ -0,0 +1,117 @@
+1900 0 1 0
+10 Cubit 12.2 17 ACIS 19.0.2 Linux 24 Mon Jan 6 14:16:03 2014
+1 9.9999999999999995e-07 1e-10
+body $1 -1 -1 $-1 $2 $-1 $-1 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+lump $3 -1 -1 $-1 $-1 $4 $0 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+shell $-1 -1 -1 $-1 $-1 $-1 $5 $-1 $2 T -5 -5 -5 5 5 5 #
+face $6 -1 -1 $-1 $7 $8 $4 $-1 $9 forward single T -5 -5 5 5 5 5 F #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $5 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+face $10 -1 -1 $-1 $11 $12 $4 $-1 $13 reversed single T -5 -5 -5 5 5 -5 F #
+loop $-1 -1 -1 $-1 $-1 $14 $5 T -5 -5 5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 5 0 0 1 1 0 0 forward_v I I I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $7 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+face $15 -1 -1 $-1 $16 $17 $4 $-1 $18 reversed single T -5 -5 -5 5 -5 5 F #
+loop $-1 -1 -1 $-1 $-1 $19 $7 T -5 -5 -5 5 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 -5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $20 $21 $22 $23 forward $8 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $11 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+face $24 -1 -1 $-1 $25 $26 $4 $-1 $27 reversed single T -5 -5 -5 -5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $28 $11 T -5 -5 -5 5 -5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 -5 0 0 1 -0 -0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $29 $30 $31 $32 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $33 $14 $34 $35 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $14 $33 $36 $37 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $38 $39 $14 $23 reversed $40 $-1 #
+edge $41 -1 -1 $-1 $42 -5 $43 5 $22 $44 forward @7 unknown T 5 -5 5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $16 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+face $45 -1 -1 $-1 $46 $47 $4 $-1 $48 reversed single T -5 5 -5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $49 $16 T -5 -5 -5 -5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 -5 0 0 1 0 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $50 $36 $51 $52 forward $17 $-1 #
+coedge $-1 -1 -1 $-1 $53 $19 $50 $54 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $19 $53 $55 $56 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $39 $38 $19 $32 reversed $40 $-1 #
+edge $57 -1 -1 $-1 $58 -5 $59 5 $31 $60 forward @7 unknown T 5 -5 -5 5 5 -5 #
+coedge $-1 -1 -1 $-1 $21 $20 $61 $62 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $63 $64 $20 $35 reversed $47 $-1 #
+edge $65 -1 -1 $-1 $43 -5 $66 5 $34 $67 forward @7 unknown T -5 5 5 5 5 5 #
+coedge $-1 -1 -1 $-1 $28 $68 $21 $37 reversed $17 $-1 #
+edge $69 -1 -1 $-1 $70 -5 $42 5 $36 $71 forward @7 unknown T -5 -5 5 5 -5 5 #
+coedge $-1 -1 -1 $-1 $31 $22 $68 $72 forward $40 $-1 #
+coedge $-1 -1 -1 $-1 $22 $31 $63 $73 reversed $40 $-1 #
+loop $-1 -1 -1 $-1 $-1 $38 $46 T 5 -5 -5 5 5 5 unknown #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $23 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+vertex $74 -1 -1 $-1 $23 $75 #
+vertex $76 -1 -1 $-1 $23 $77 #
+straight-curve $-1 -1 -1 $-1 5 0 5 0 1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $25 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+face $78 -1 -1 $-1 $-1 $40 $4 $-1 $79 reversed single T 5 -5 -5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $63 $25 T -5 5 -5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 5 0 0 -1 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $80 $61 $64 $81 forward $26 $-1 #
+coedge $-1 -1 -1 $-1 $68 $28 $29 $54 reversed $17 $-1 #
+coedge $-1 -1 -1 $-1 $61 $80 $28 $52 reversed $26 $-1 #
+edge $82 -1 -1 $-1 $70 -5 $83 5 $51 $84 forward @7 unknown T -5 -5 -5 -5 -5 5 #
+coedge $-1 -1 -1 $-1 $30 $29 $80 $85 forward $12 $-1 #
+edge $86 -1 -1 $-1 $59 -5 $83 5 $50 $87 forward @7 unknown T -5 -5 -5 5 -5 -5 #
+coedge $-1 -1 -1 $-1 $64 $63 $30 $56 reversed $47 $-1 #
+edge $88 -1 -1 $-1 $89 -5 $58 5 $55 $90 forward @7 unknown T -5 5 -5 5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $32 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+vertex $91 -1 -1 $-1 $32 $92 #
+vertex $93 -1 -1 $-1 $72 $94 #
+straight-curve $-1 -1 -1 $-1 5 0 -5 0 -1 0 I I #
+coedge $-1 -1 -1 $-1 $49 $51 $33 $62 reversed $26 $-1 #
+edge $95 -1 -1 $-1 $66 -5 $70 5 $61 $96 forward @7 unknown T -5 -5 5 -5 5 5 #
+coedge $-1 -1 -1 $-1 $55 $34 $39 $73 forward $47 $-1 #
+coedge $-1 -1 -1 $-1 $34 $55 $49 $81 reversed $47 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $35 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+vertex $97 -1 -1 $-1 $35 $98 #
+straight-curve $-1 -1 -1 $-1 0 5 5 -1 0 0 I I #
+coedge $-1 -1 -1 $-1 $36 $50 $38 $72 reversed $17 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $37 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+vertex $99 -1 -1 $-1 $62 $100 #
+straight-curve $-1 -1 -1 $-1 0 -5 5 1 0 0 I I #
+edge $101 -1 -1 $-1 $42 -5 $59 5 $38 $102 forward @7 unknown T 5 -5 -5 5 -5 5 #
+edge $103 -1 -1 $-1 $43 -5 $58 5 $39 $104 forward @7 unknown T 5 5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $42 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+point $-1 -1 -1 $-1 5 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $43 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+point $-1 -1 -1 $-1 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $46 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+plane-surface $-1 -1 -1 $-1 5 0 0 -1 0 0 0 -0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $51 $49 $53 $85 reversed $26 $-1 #
+edge $105 -1 -1 $-1 $66 -5 $89 5 $64 $106 forward @7 unknown T -5 5 -5 -5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $52 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+vertex $107 -1 -1 $-1 $85 $108 #
+straight-curve $-1 -1 -1 $-1 -5 -5 0 0 0 -1 I I #
+edge $109 -1 -1 $-1 $83 -5 $89 5 $80 $110 forward @7 unknown T -5 -5 -5 -5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $54 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+straight-curve $-1 -1 -1 $-1 0 -5 -5 -1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $56 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+vertex $111 -1 -1 $-1 $56 $112 #
+straight-curve $-1 -1 -1 $-1 0 5 -5 1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $58 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+point $-1 -1 -1 $-1 5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $59 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+point $-1 -1 -1 $-1 5 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $62 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+straight-curve $-1 -1 -1 $-1 -5 0 5 0 -1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $66 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+point $-1 -1 -1 $-1 -5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $70 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+point $-1 -1 -1 $-1 -5 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $72 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+straight-curve $-1 -1 -1 $-1 5 -5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $73 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 12 #
+straight-curve $-1 -1 -1 $-1 5 5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $81 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 11 #
+straight-curve $-1 -1 -1 $-1 -5 5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $83 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+point $-1 -1 -1 $-1 -5 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $85 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+straight-curve $-1 -1 -1 $-1 -5 0 -5 0 1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $89 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+point $-1 -1 -1 $-1 -5 5 -5 #
+End-of-ACIS-data
\ No newline at end of file
diff --git a/MeshFiles/unittest/io/cube.stp b/MeshFiles/unittest/io/cube.stp
new file mode 100644
index 0000000..c17645d
--- /dev/null
+++ b/MeshFiles/unittest/io/cube.stp
@@ -0,0 +1,185 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('STEP AP214'),'1');
+FILE_NAME('/home/iulian/source/MOABsource/MeshFiles/unittest/io/cube.stp','2014-02-11T15:06:47',(' '),(' '),'Spatial InterOp 3D',' ',' ');
+FILE_SCHEMA(('automotive_design'));
+ENDSEC;
+DATA;
+#1=PRODUCT_DEFINITION_CONTEXT('',#9,'design');
+#2=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#9);
+#3=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#10,#11);
+#4=SHAPE_DEFINITION_REPRESENTATION(#12,#13);
+#5= (GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#16))GLOBAL_UNIT_ASSIGNED_CONTEXT((#18,#19,#20))REPRESENTATION_CONTEXT('NONE','WORKSPACE'));
+#9=APPLICATION_CONTEXT(' ');
+#10=PRODUCT_CATEGORY('part','NONE');
+#11=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#22));
+#12=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#23);
+#13=ADVANCED_BREP_SHAPE_REPRESENTATION('1',(#24,#25),#5);
+#16=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-06),#18,'','');
+#18= (CONVERSION_BASED_UNIT('MILLIMETRE',#28)LENGTH_UNIT()NAMED_UNIT(#31));
+#19= (NAMED_UNIT(#33)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#20= (NAMED_UNIT(#33)SOLID_ANGLE_UNIT()SI_UNIT($,.STERADIAN.));
+#22=PRODUCT('1','1','PART-1-DESC',(#39));
+#23=PRODUCT_DEFINITION('NONE','NONE',#40,#1);
+#24=MANIFOLD_SOLID_BREP('1',#41);
+#25=AXIS2_PLACEMENT_3D('',#42,#43,#44);
+#28=LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0),#45);
+#31=DIMENSIONAL_EXPONENTS(1.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#33=DIMENSIONAL_EXPONENTS(0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#39=PRODUCT_CONTEXT('',#9,'mechanical');
+#40=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#22,.NOT_KNOWN.);
+#41=CLOSED_SHELL('',(#46,#47,#48,#49,#50,#51));
+#42=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#43=DIRECTION('',(0.0,0.0,1.0));
+#44=DIRECTION('',(1.0,0.0,0.0));
+#45= (NAMED_UNIT(#31)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.));
+#46=ADVANCED_FACE('',(#53),#54,.T.);
+#47=ADVANCED_FACE('',(#55),#56,.F.);
+#48=ADVANCED_FACE('',(#57),#58,.F.);
+#49=ADVANCED_FACE('',(#59),#60,.F.);
+#50=ADVANCED_FACE('',(#61),#62,.F.);
+#51=ADVANCED_FACE('',(#63),#64,.F.);
+#53=FACE_OUTER_BOUND('',#65,.T.);
+#54=PLANE('',#66);
+#55=FACE_OUTER_BOUND('',#67,.T.);
+#56=PLANE('',#68);
+#57=FACE_OUTER_BOUND('',#69,.T.);
+#58=PLANE('',#70);
+#59=FACE_OUTER_BOUND('',#71,.T.);
+#60=PLANE('',#72);
+#61=FACE_OUTER_BOUND('',#73,.T.);
+#62=PLANE('',#74);
+#63=FACE_OUTER_BOUND('',#75,.T.);
+#64=PLANE('',#76);
+#65=EDGE_LOOP('',(#77,#78,#79,#80));
+#66=AXIS2_PLACEMENT_3D('',#81,#82,#83);
+#67=EDGE_LOOP('',(#84,#85,#86,#87));
+#68=AXIS2_PLACEMENT_3D('',#88,#89,#90);
+#69=EDGE_LOOP('',(#91,#92,#93,#94));
+#70=AXIS2_PLACEMENT_3D('',#95,#96,#97);
+#71=EDGE_LOOP('',(#98,#99,#100,#101));
+#72=AXIS2_PLACEMENT_3D('',#102,#103,#104);
+#73=EDGE_LOOP('',(#105,#106,#107,#108));
+#74=AXIS2_PLACEMENT_3D('',#109,#110,#111);
+#75=EDGE_LOOP('',(#112,#113,#114,#115));
+#76=AXIS2_PLACEMENT_3D('',#116,#117,#118);
+#77=ORIENTED_EDGE('',*,*,#119,.T.);
+#78=ORIENTED_EDGE('',*,*,#120,.T.);
+#79=ORIENTED_EDGE('',*,*,#121,.T.);
+#80=ORIENTED_EDGE('',*,*,#122,.T.);
+#81=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#82=DIRECTION('',(0.0,0.0,1.0));
+#83=DIRECTION('',(1.0,0.0,0.0));
+#84=ORIENTED_EDGE('',*,*,#123,.T.);
+#85=ORIENTED_EDGE('',*,*,#124,.T.);
+#86=ORIENTED_EDGE('',*,*,#125,.T.);
+#87=ORIENTED_EDGE('',*,*,#126,.T.);
+#88=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#89=DIRECTION('',(0.0,0.0,1.0));
+#90=DIRECTION('',(1.0,0.0,0.0));
+#91=ORIENTED_EDGE('',*,*,#127,.T.);
+#92=ORIENTED_EDGE('',*,*,#124,.F.);
+#93=ORIENTED_EDGE('',*,*,#128,.F.);
+#94=ORIENTED_EDGE('',*,*,#122,.F.);
+#95=CARTESIAN_POINT('',(0.0,-5.0,0.0));
+#96=DIRECTION('',(0.0,1.0,-0.0));
+#97=DIRECTION('',(-0.0,0.0,1.0));
+#98=ORIENTED_EDGE('',*,*,#129,.T.);
+#99=ORIENTED_EDGE('',*,*,#125,.F.);
+#100=ORIENTED_EDGE('',*,*,#127,.F.);
+#101=ORIENTED_EDGE('',*,*,#121,.F.);
+#102=CARTESIAN_POINT('',(-5.0,0.0,0.0));
+#103=DIRECTION('',(1.0,0.0,0.0));
+#104=DIRECTION('',(0.0,0.0,-1.0));
+#105=ORIENTED_EDGE('',*,*,#130,.T.);
+#106=ORIENTED_EDGE('',*,*,#126,.F.);
+#107=ORIENTED_EDGE('',*,*,#129,.F.);
+#108=ORIENTED_EDGE('',*,*,#120,.F.);
+#109=CARTESIAN_POINT('',(0.0,5.0,0.0));
+#110=DIRECTION('',(0.0,-1.0,0.0));
+#111=DIRECTION('',(0.0,0.0,-1.0));
+#112=ORIENTED_EDGE('',*,*,#128,.T.);
+#113=ORIENTED_EDGE('',*,*,#123,.F.);
+#114=ORIENTED_EDGE('',*,*,#130,.F.);
+#115=ORIENTED_EDGE('',*,*,#119,.F.);
+#116=CARTESIAN_POINT('',(5.0,0.0,0.0));
+#117=DIRECTION('',(-1.0,0.0,0.0));
+#118=DIRECTION('',(0.0,-0.0,1.0));
+#119=EDGE_CURVE('',#131,#132,#133,.T.);
+#120=EDGE_CURVE('',#132,#134,#135,.T.);
+#121=EDGE_CURVE('',#134,#136,#137,.T.);
+#122=EDGE_CURVE('',#136,#131,#138,.T.);
+#123=EDGE_CURVE('',#139,#140,#141,.T.);
+#124=EDGE_CURVE('',#140,#142,#143,.T.);
+#125=EDGE_CURVE('',#142,#144,#145,.T.);
+#126=EDGE_CURVE('',#144,#139,#146,.T.);
+#127=EDGE_CURVE('',#136,#142,#147,.T.);
+#128=EDGE_CURVE('',#131,#140,#148,.T.);
+#129=EDGE_CURVE('',#134,#144,#149,.T.);
+#130=EDGE_CURVE('',#132,#139,#150,.T.);
+#131=VERTEX_POINT('',#151);
+#132=VERTEX_POINT('',#152);
+#133=LINE('',#153,#154);
+#134=VERTEX_POINT('',#155);
+#135=LINE('',#156,#157);
+#136=VERTEX_POINT('',#158);
+#137=LINE('',#159,#160);
+#138=LINE('',#161,#162);
+#139=VERTEX_POINT('',#163);
+#140=VERTEX_POINT('',#164);
+#141=LINE('',#165,#166);
+#142=VERTEX_POINT('',#167);
+#143=LINE('',#168,#169);
+#144=VERTEX_POINT('',#170);
+#145=LINE('',#171,#172);
+#146=LINE('',#173,#174);
+#147=LINE('',#175,#176);
+#148=LINE('',#177,#178);
+#149=LINE('',#179,#180);
+#150=LINE('',#181,#182);
+#151=CARTESIAN_POINT('',(5.0,-5.0,5.0));
+#152=CARTESIAN_POINT('',(5.0,5.0,5.0));
+#153=CARTESIAN_POINT('',(5.0,0.0,5.0));
+#154=VECTOR('',#183,1.0);
+#155=CARTESIAN_POINT('',(-5.0,5.0,5.0));
+#156=CARTESIAN_POINT('',(0.0,5.0,5.0));
+#157=VECTOR('',#184,1.0);
+#158=CARTESIAN_POINT('',(-5.0,-5.0,5.0));
+#159=CARTESIAN_POINT('',(-5.0,0.0,5.0));
+#160=VECTOR('',#185,1.0);
+#161=CARTESIAN_POINT('',(0.0,-5.0,5.0));
+#162=VECTOR('',#186,1.0);
+#163=CARTESIAN_POINT('',(5.0,5.0,-5.0));
+#164=CARTESIAN_POINT('',(5.0,-5.0,-5.0));
+#165=CARTESIAN_POINT('',(5.0,0.0,-5.0));
+#166=VECTOR('',#187,1.0);
+#167=CARTESIAN_POINT('',(-5.0,-5.0,-5.0));
+#168=CARTESIAN_POINT('',(0.0,-5.0,-5.0));
+#169=VECTOR('',#188,1.0);
+#170=CARTESIAN_POINT('',(-5.0,5.0,-5.0));
+#171=CARTESIAN_POINT('',(-5.0,0.0,-5.0));
+#172=VECTOR('',#189,1.0);
+#173=CARTESIAN_POINT('',(0.0,5.0,-5.0));
+#174=VECTOR('',#190,1.0);
+#175=CARTESIAN_POINT('',(-5.0,-5.0,0.0));
+#176=VECTOR('',#191,1.0);
+#177=CARTESIAN_POINT('',(5.0,-5.0,0.0));
+#178=VECTOR('',#192,1.0);
+#179=CARTESIAN_POINT('',(-5.0,5.0,0.0));
+#180=VECTOR('',#193,1.0);
+#181=CARTESIAN_POINT('',(5.0,5.0,0.0));
+#182=VECTOR('',#194,1.0);
+#183=DIRECTION('',(0.0,1.0,0.0));
+#184=DIRECTION('',(-1.0,0.0,0.0));
+#185=DIRECTION('',(0.0,-1.0,0.0));
+#186=DIRECTION('',(1.0,0.0,0.0));
+#187=DIRECTION('',(0.0,-1.0,0.0));
+#188=DIRECTION('',(-1.0,0.0,0.0));
+#189=DIRECTION('',(0.0,1.0,0.0));
+#190=DIRECTION('',(1.0,0.0,0.0));
+#191=DIRECTION('',(0.0,0.0,-1.0));
+#192=DIRECTION('',(0.0,0.0,-1.0));
+#193=DIRECTION('',(0.0,0.0,-1.0));
+#194=DIRECTION('',(0.0,0.0,-1.0));
+ENDSEC;
+END-ISO-10303-21;
diff --git a/MeshFiles/unittest/io/cubtest14.cub b/MeshFiles/unittest/io/cubtest14.cub
new file mode 100644
index 0000000..ae88269
Binary files /dev/null and b/MeshFiles/unittest/io/cubtest14.cub differ
diff --git a/MeshFiles/unittest/io/cylcube.sat b/MeshFiles/unittest/io/cylcube.sat
new file mode 100644
index 0000000..0b65976
--- /dev/null
+++ b/MeshFiles/unittest/io/cylcube.sat
@@ -0,0 +1,202 @@
+1900 0 2 0
+10 Cubit 12.2 17 ACIS 19.0.2 Linux 24 Thu Feb 6 08:36:54 2014
+1 9.9999999999999995e-07 1e-10
+body $2 -1 -1 $-1 $3 $-1 $4 T 25 -5 -5 35 5 5 #
+body $5 -1 -1 $-1 $6 $-1 $-1 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $7 $-1 $0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+lump $8 -1 -1 $-1 $-1 $9 $0 T 25 -5 -5 35 5 5 #
+transform $-1 -1 1 0 0 0 1 0 0 0 1 0 0 0 1 no_rotate no_reflect no_shear #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $10 $-1 $1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+lump $11 -1 -1 $-1 $-1 $12 $1 T -5 -5 -5 5 5 5 #
+simple-snl-attrib $-1 -1 $-1 $2 $0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $13 $-1 $3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+shell $-1 -1 -1 $-1 $-1 $-1 $14 $-1 $3 T 25 -5 -5 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $5 $1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $15 $-1 $6 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+shell $-1 -1 -1 $-1 $-1 $-1 $16 $-1 $6 T -5 -5 -5 5 5 5 #
+simple-snl-attrib $-1 -1 $17 $8 $3 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+face $18 -1 -1 $-1 $19 $20 $9 $-1 $21 forward single T 25 -5 5 35 5 5 F #
+simple-snl-attrib $-1 -1 $22 $11 $6 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+face $23 -1 -1 $-1 $24 $25 $12 $-1 $26 forward single T -5 -5 -5 5 5 5 F #
+simple-snl-attrib $-1 -1 $27 $13 $3 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 2 @5 GROUP @7 Group 2 0 7 1 2 618932362 0 0 0 0 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $28 $-1 $14 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+face $29 -1 -1 $-1 $30 $31 $9 $-1 $32 reversed single T 25 -5 -5 35 5 -5 F #
+loop $-1 -1 -1 $-1 $-1 $33 $14 T 25 -5 5 35 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 30 0 5 0 0 1 1 0 0 forward_v I I I I #
+simple-snl-attrib $-1 -1 $34 $15 $6 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 2 @5 GROUP @7 Group 3 0 7 1 3 885205176 0 0 0 0 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $35 $-1 $16 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+face $36 -1 -1 $-1 $37 $38 $12 $-1 $39 forward single T -5 -5 -5 5 5 -5 F #
+loop $-1 -1 -1 $-1 $40 $41 $16 T -5 -5 -5 5 5 -5 unknown #
+cone-surface $-1 -1 -1 $-1 0 0 0 0 0 1 5 0 0 1 I I 0 1 5 forward I I I I #
+simple-snl-attrib $-1 -1 $-1 $17 $3 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 7 @16 GRAPHICS_OPTIONS @14 geometry color @10 mesh color @19 geometry visibility @15 mesh visibility @11 render mode @11 transparent 0 6 4 4 1 1 0 0 #
+simple-snl-attrib $-1 -1 $42 $18 $14 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $43 $-1 $19 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+face $44 -1 -1 $-1 $45 $46 $9 $-1 $47 reversed single T 25 -5 -5 35 -5 5 F #
+loop $-1 -1 -1 $-1 $-1 $48 $19 T 25 -5 -5 35 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 30 0 -5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $49 $50 $51 $52 forward $20 $-1 #
+simple-snl-attrib $-1 -1 $-1 $22 $6 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 7 @16 GRAPHICS_OPTIONS @14 geometry color @10 mesh color @19 geometry visibility @15 mesh visibility @11 render mode @11 transparent 0 6 5 5 1 1 0 0 #
+simple-snl-attrib $-1 -1 $53 $23 $16 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 7 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $54 $-1 $24 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+face $55 -1 -1 $-1 $-1 $56 $12 $-1 $57 forward single T -5 -5 5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $58 $24 T -5 -5 -5 5 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 -5 0 0 -1 -1 0 0 forward_v I I I I #
+loop $-1 -1 -1 $-1 $-1 $59 $16 T -5 -5 5 5 5 5 unknown #
+coedge $-1 -1 -1 $-1 $41 $41 $58 $60 reversed $25 $-1 #
+simple-snl-attrib $-1 -1 $-1 $28 $14 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $61 $29 $19 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $62 $-1 $30 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+face $63 -1 -1 $-1 $64 $65 $9 $-1 $66 reversed single T 25 -5 -5 25 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $67 $30 T 25 -5 -5 35 -5 5 unknown #
+plane-surface $-1 -1 -1 $-1 30 -5 0 0 1 0 0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $68 $69 $70 $71 forward $31 $-1 #
+coedge $-1 -1 -1 $-1 $72 $33 $73 $74 forward $20 $-1 #
+coedge $-1 -1 -1 $-1 $33 $72 $75 $76 forward $20 $-1 #
+coedge $-1 -1 -1 $-1 $77 $78 $33 $52 reversed $79 $-1 #
+edge $80 -1 -1 $-1 $81 -5 $82 5 $51 $83 forward @7 unknown T 35 -5 5 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $35 $16 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $84 $36 $24 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 8 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $85 $-1 $37 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+loop $-1 -1 -1 $-1 $-1 $86 $37 T -5 -5 5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $58 $58 $41 $60 forward $38 $-1 #
+coedge $-1 -1 -1 $-1 $59 $59 $86 $87 reversed $40 $-1 #
+edge $88 -1 -1 $-1 $89 0 $89 6.2831853071795862 $58 $90 forward @7 unknown T -5 -5 -5 5 5 -5 #
+simple-snl-attrib $-1 -1 $-1 $43 $19 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $91 $44 $30 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 3 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $92 $-1 $45 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+face $93 -1 -1 $-1 $94 $95 $9 $-1 $96 reversed single T 25 5 -5 35 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $97 $45 T 25 -5 -5 25 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 25 0 0 1 0 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $98 $75 $99 $100 forward $46 $-1 #
+coedge $-1 -1 -1 $-1 $101 $48 $98 $102 forward $31 $-1 #
+coedge $-1 -1 -1 $-1 $48 $101 $103 $104 forward $31 $-1 #
+coedge $-1 -1 -1 $-1 $78 $77 $48 $71 reversed $79 $-1 #
+edge $105 -1 -1 $-1 $106 -5 $107 5 $70 $108 forward @7 unknown T 35 -5 -5 35 5 -5 #
+coedge $-1 -1 -1 $-1 $50 $49 $109 $110 forward $20 $-1 #
+coedge $-1 -1 -1 $-1 $111 $112 $49 $74 reversed $95 $-1 #
+edge $113 -1 -1 $-1 $82 -5 $114 5 $73 $115 forward @7 unknown T 25 5 5 35 5 5 #
+coedge $-1 -1 -1 $-1 $67 $116 $50 $76 reversed $46 $-1 #
+edge $117 -1 -1 $-1 $118 -5 $81 5 $75 $119 forward @7 unknown T 25 -5 5 35 -5 5 #
+coedge $-1 -1 -1 $-1 $70 $51 $116 $120 forward $79 $-1 #
+coedge $-1 -1 -1 $-1 $51 $70 $111 $121 reversed $79 $-1 #
+loop $-1 -1 -1 $-1 $-1 $77 $94 T 35 -5 -5 35 5 5 unknown #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $122 $-1 $52 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+vertex $123 -1 -1 $-1 $52 $124 #
+vertex $125 -1 -1 $-1 $52 $126 #
+straight-curve $-1 -1 -1 $-1 35 0 5 0 1 0 I I #
+simple-snl-attrib $-1 -1 $-1 $54 $24 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $127 $55 $37 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 9 -2147483648 -1 #
+coedge $-1 -1 -1 $-1 $86 $86 $59 $87 forward $56 $-1 #
+edge $128 -1 -1 $-1 $129 0 $129 6.2831853071795862 $86 $130 forward @7 unknown T -5 -5 5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $131 $-1 $60 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 13 #
+vertex $132 -1 -1 $-1 $60 $133 #
+ellipse-curve $-1 -1 -1 $-1 0 0 -5 0 0 -1 5 0 0 1 I I #
+simple-snl-attrib $-1 -1 $-1 $62 $30 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $134 $63 $45 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 4 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $135 $-1 $64 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+face $136 -1 -1 $-1 $-1 $79 $9 $-1 $137 reversed single T 35 -5 -5 35 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $111 $64 T 25 5 -5 35 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 30 5 0 0 -1 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $138 $109 $112 $139 forward $65 $-1 #
+coedge $-1 -1 -1 $-1 $116 $67 $68 $102 reversed $46 $-1 #
+coedge $-1 -1 -1 $-1 $109 $138 $67 $100 reversed $65 $-1 #
+edge $140 -1 -1 $-1 $118 -5 $141 5 $99 $142 forward @7 unknown T 25 -5 -5 25 -5 5 #
+coedge $-1 -1 -1 $-1 $69 $68 $138 $143 forward $31 $-1 #
+edge $144 -1 -1 $-1 $107 -5 $141 5 $98 $145 forward @7 unknown T 25 -5 -5 35 -5 -5 #
+coedge $-1 -1 -1 $-1 $112 $111 $69 $104 reversed $95 $-1 #
+edge $146 -1 -1 $-1 $147 -5 $106 5 $103 $148 forward @7 unknown T 25 5 -5 35 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $149 $-1 $71 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+vertex $150 -1 -1 $-1 $71 $151 #
+vertex $152 -1 -1 $-1 $120 $153 #
+straight-curve $-1 -1 -1 $-1 35 0 -5 0 -1 0 I I #
+coedge $-1 -1 -1 $-1 $97 $99 $72 $110 reversed $65 $-1 #
+edge $154 -1 -1 $-1 $114 -5 $118 5 $109 $155 forward @7 unknown T 25 -5 5 25 5 5 #
+coedge $-1 -1 -1 $-1 $103 $73 $78 $121 forward $95 $-1 #
+coedge $-1 -1 -1 $-1 $73 $103 $97 $139 reversed $95 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $156 $-1 $74 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+vertex $157 -1 -1 $-1 $74 $158 #
+straight-curve $-1 -1 -1 $-1 30 5 5 -1 0 0 I I #
+coedge $-1 -1 -1 $-1 $75 $98 $77 $120 reversed $46 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $159 $-1 $76 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+vertex $160 -1 -1 $-1 $110 $161 #
+straight-curve $-1 -1 -1 $-1 30 -5 5 1 0 0 I I #
+edge $162 -1 -1 $-1 $81 -5 $107 5 $77 $163 forward @7 unknown T 35 -5 -5 35 -5 5 #
+edge $164 -1 -1 $-1 $82 -5 $106 5 $78 $165 forward @7 unknown T 35 5 -5 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $80 $52 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $166 $-1 $81 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+point $-1 -1 -1 $-1 35 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $167 $-1 $82 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+point $-1 -1 -1 $-1 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $85 $37 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $168 $-1 $87 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 14 #
+vertex $169 -1 -1 $-1 $87 $170 #
+ellipse-curve $-1 -1 -1 $-1 0 0 5 0 0 1 5 0 0 1 I I #
+simple-snl-attrib $-1 -1 $-1 $88 $60 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 13 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $171 $-1 $89 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+point $-1 -1 -1 $-1 5 0 -5 #
+simple-snl-attrib $-1 -1 $-1 $92 $45 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $172 $93 $64 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 5 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $173 $-1 $94 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+plane-surface $-1 -1 -1 $-1 35 0 0 -1 0 0 0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $99 $97 $101 $143 reversed $65 $-1 #
+edge $174 -1 -1 $-1 $114 -5 $147 5 $112 $175 forward @7 unknown T 25 5 -5 25 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $176 $-1 $100 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+vertex $177 -1 -1 $-1 $143 $178 #
+straight-curve $-1 -1 -1 $-1 25 -5 0 0 0 -1 I I #
+edge $179 -1 -1 $-1 $141 -5 $147 5 $138 $180 forward @7 unknown T 25 -5 -5 25 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $181 $-1 $102 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+straight-curve $-1 -1 -1 $-1 30 -5 -5 -1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $182 $-1 $104 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+vertex $183 -1 -1 $-1 $104 $184 #
+straight-curve $-1 -1 -1 $-1 30 5 -5 1 0 0 I I #
+simple-snl-attrib $-1 -1 $-1 $105 $71 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 5 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $185 $-1 $106 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+point $-1 -1 -1 $-1 35 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $186 $-1 $107 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+point $-1 -1 -1 $-1 35 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $187 $-1 $110 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+straight-curve $-1 -1 -1 $-1 25 0 5 0 -1 0 I I #
+simple-snl-attrib $-1 -1 $-1 $113 $74 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $188 $-1 $114 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+point $-1 -1 -1 $-1 25 5 5 #
+simple-snl-attrib $-1 -1 $-1 $117 $76 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 4 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $189 $-1 $118 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+point $-1 -1 -1 $-1 25 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $190 $-1 $120 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+straight-curve $-1 -1 -1 $-1 35 -5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $191 $-1 $121 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 12 #
+straight-curve $-1 -1 -1 $-1 35 5 0 0 0 -1 I I #
+simple-snl-attrib $-1 -1 $-1 $123 $81 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $125 $82 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $128 $87 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 14 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $192 $-1 $129 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+point $-1 -1 -1 $-1 5 0 5 #
+simple-snl-attrib $-1 -1 $-1 $132 $89 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 9 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $135 $64 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $193 $136 $94 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 6 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $194 $-1 $139 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 11 #
+straight-curve $-1 -1 -1 $-1 25 5 0 0 0 -1 I I #
+simple-snl-attrib $-1 -1 $-1 $140 $100 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 9 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $195 $-1 $141 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+point $-1 -1 -1 $-1 25 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $196 $-1 $143 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+straight-curve $-1 -1 -1 $-1 25 0 -5 0 1 0 I I #
+simple-snl-attrib $-1 -1 $-1 $144 $102 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 6 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $146 $104 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 8 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $197 $-1 $147 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+point $-1 -1 -1 $-1 25 5 -5 #
+simple-snl-attrib $-1 -1 $-1 $150 $106 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 5 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $152 $107 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 6 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $154 $110 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 3 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $157 $114 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 3 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $160 $118 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 4 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $162 $120 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 10 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $164 $121 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 12 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $169 $129 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 10 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $173 $94 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $-1 $174 $139 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 11 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $177 $141 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 7 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $179 $143 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 7 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $183 $147 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 8 -2147483648 -1 #
+End-of-ACIS-data
\ No newline at end of file
diff --git a/MeshFiles/unittest/io/cylcube.stp b/MeshFiles/unittest/io/cylcube.stp
new file mode 100644
index 0000000..bc4ec64
--- /dev/null
+++ b/MeshFiles/unittest/io/cylcube.stp
@@ -0,0 +1,290 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('STEP AP214'),'1');
+FILE_NAME('/home/user/cylcube.stp','2014-02-15T18:13:39',(' '),(' '),'Spatial InterOp 3D',' ',' ');
+FILE_SCHEMA(('automotive_design'));
+ENDSEC;
+DATA;
+#1=PRODUCT_DEFINITION_CONTEXT('',#13,'design');
+#2=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#13);
+#3=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#14,#15);
+#4=SHAPE_DEFINITION_REPRESENTATION(#16,#17);
+#5=PRODUCT_DEFINITION_CONTEXT('',#18,'design');
+#6=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#18);
+#7=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#19,#20);
+#8=SHAPE_DEFINITION_REPRESENTATION(#21,#22);
+#9= (GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#25))GLOBAL_UNIT_ASSIGNED_CONTEXT((#27,#28,#29))REPRESENTATION_CONTEXT('NONE','WORKSPACE'));
+#13=APPLICATION_CONTEXT(' ');
+#14=PRODUCT_CATEGORY('part','NONE');
+#15=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#31));
+#16=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#32);
+#17=ADVANCED_BREP_SHAPE_REPRESENTATION('1',(#33,#34),#9);
+#18=APPLICATION_CONTEXT(' ');
+#19=PRODUCT_CATEGORY('part','NONE');
+#20=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#35));
+#21=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#36);
+#22=ADVANCED_BREP_SHAPE_REPRESENTATION('2',(#37,#38),#9);
+#25=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-06),#27,'','');
+#27= (CONVERSION_BASED_UNIT('MILLIMETRE',#41)LENGTH_UNIT()NAMED_UNIT(#44));
+#28= (NAMED_UNIT(#46)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#29= (NAMED_UNIT(#46)SOLID_ANGLE_UNIT()SI_UNIT($,.STERADIAN.));
+#31=PRODUCT('1','1','PART-1-DESC',(#52));
+#32=PRODUCT_DEFINITION('NONE','NONE',#53,#1);
+#33=MANIFOLD_SOLID_BREP('1',#54);
+#34=AXIS2_PLACEMENT_3D('',#55,#56,#57);
+#35=PRODUCT('2','2','PART-2-DESC',(#58));
+#36=PRODUCT_DEFINITION('NONE','NONE',#59,#5);
+#37=MANIFOLD_SOLID_BREP('2',#60);
+#38=AXIS2_PLACEMENT_3D('',#61,#62,#63);
+#41=LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0),#64);
+#44=DIMENSIONAL_EXPONENTS(1.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#46=DIMENSIONAL_EXPONENTS(0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#52=PRODUCT_CONTEXT('',#13,'mechanical');
+#53=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#31,.NOT_KNOWN.);
+#54=CLOSED_SHELL('',(#65,#66,#67,#68,#69,#70));
+#55=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#56=DIRECTION('',(0.0,0.0,1.0));
+#57=DIRECTION('',(1.0,0.0,0.0));
+#58=PRODUCT_CONTEXT('',#18,'mechanical');
+#59=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#35,.NOT_KNOWN.);
+#60=CLOSED_SHELL('',(#71,#72,#73,#74));
+#61=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#62=DIRECTION('',(0.0,0.0,1.0));
+#63=DIRECTION('',(1.0,0.0,0.0));
+#64= (NAMED_UNIT(#44)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.));
+#65=ADVANCED_FACE('',(#76),#77,.T.);
+#66=ADVANCED_FACE('',(#78),#79,.F.);
+#67=ADVANCED_FACE('',(#80),#81,.F.);
+#68=ADVANCED_FACE('',(#82),#83,.F.);
+#69=ADVANCED_FACE('',(#84),#85,.F.);
+#70=ADVANCED_FACE('',(#86),#87,.F.);
+#71=ADVANCED_FACE('',(#88),#89,.T.);
+#72=ADVANCED_FACE('',(#90),#91,.T.);
+#73=ADVANCED_FACE('',(#92),#93,.T.);
+#74=ADVANCED_FACE('',(#94),#95,.T.);
+#76=FACE_OUTER_BOUND('',#96,.T.);
+#77=PLANE('',#97);
+#78=FACE_OUTER_BOUND('',#98,.T.);
+#79=PLANE('',#99);
+#80=FACE_OUTER_BOUND('',#100,.T.);
+#81=PLANE('',#101);
+#82=FACE_OUTER_BOUND('',#102,.T.);
+#83=PLANE('',#103);
+#84=FACE_OUTER_BOUND('',#104,.T.);
+#85=PLANE('',#105);
+#86=FACE_OUTER_BOUND('',#106,.T.);
+#87=PLANE('',#107);
+#88=FACE_OUTER_BOUND('',#108,.T.);
+#89=CYLINDRICAL_SURFACE('',#109,5.0);
+#90=FACE_OUTER_BOUND('',#110,.T.);
+#91=CYLINDRICAL_SURFACE('',#111,5.0);
+#92=FACE_OUTER_BOUND('',#112,.T.);
+#93=PLANE('',#113);
+#94=FACE_OUTER_BOUND('',#114,.T.);
+#95=PLANE('',#115);
+#96=EDGE_LOOP('',(#116,#117,#118,#119));
+#97=AXIS2_PLACEMENT_3D('',#120,#121,#122);
+#98=EDGE_LOOP('',(#123,#124,#125,#126));
+#99=AXIS2_PLACEMENT_3D('',#127,#128,#129);
+#100=EDGE_LOOP('',(#130,#131,#132,#133));
+#101=AXIS2_PLACEMENT_3D('',#134,#135,#136);
+#102=EDGE_LOOP('',(#137,#138,#139,#140));
+#103=AXIS2_PLACEMENT_3D('',#141,#142,#143);
+#104=EDGE_LOOP('',(#144,#145,#146,#147));
+#105=AXIS2_PLACEMENT_3D('',#148,#149,#150);
+#106=EDGE_LOOP('',(#151,#152,#153,#154));
+#107=AXIS2_PLACEMENT_3D('',#155,#156,#157);
+#108=EDGE_LOOP('',(#158,#159,#160,#161));
+#109=AXIS2_PLACEMENT_3D('',#162,#163,#164);
+#110=EDGE_LOOP('',(#165,#166,#167,#168));
+#111=AXIS2_PLACEMENT_3D('',#169,#170,#171);
+#112=EDGE_LOOP('',(#172,#173));
+#113=AXIS2_PLACEMENT_3D('',#174,#175,#176);
+#114=EDGE_LOOP('',(#177,#178));
+#115=AXIS2_PLACEMENT_3D('',#179,#180,#181);
+#116=ORIENTED_EDGE('',*,*,#182,.T.);
+#117=ORIENTED_EDGE('',*,*,#183,.T.);
+#118=ORIENTED_EDGE('',*,*,#184,.T.);
+#119=ORIENTED_EDGE('',*,*,#185,.T.);
+#120=CARTESIAN_POINT('',(30.0,0.0,5.0));
+#121=DIRECTION('',(0.0,0.0,1.0));
+#122=DIRECTION('',(1.0,0.0,0.0));
+#123=ORIENTED_EDGE('',*,*,#186,.T.);
+#124=ORIENTED_EDGE('',*,*,#187,.T.);
+#125=ORIENTED_EDGE('',*,*,#188,.T.);
+#126=ORIENTED_EDGE('',*,*,#189,.T.);
+#127=CARTESIAN_POINT('',(30.0,0.0,-5.0));
+#128=DIRECTION('',(0.0,0.0,1.0));
+#129=DIRECTION('',(1.0,0.0,0.0));
+#130=ORIENTED_EDGE('',*,*,#190,.T.);
+#131=ORIENTED_EDGE('',*,*,#187,.F.);
+#132=ORIENTED_EDGE('',*,*,#191,.F.);
+#133=ORIENTED_EDGE('',*,*,#185,.F.);
+#134=CARTESIAN_POINT('',(30.0,-5.0,0.0));
+#135=DIRECTION('',(0.0,1.0,0.0));
+#136=DIRECTION('',(0.0,0.0,1.0));
+#137=ORIENTED_EDGE('',*,*,#192,.T.);
+#138=ORIENTED_EDGE('',*,*,#188,.F.);
+#139=ORIENTED_EDGE('',*,*,#190,.F.);
+#140=ORIENTED_EDGE('',*,*,#184,.F.);
+#141=CARTESIAN_POINT('',(25.0,0.0,0.0));
+#142=DIRECTION('',(1.0,0.0,0.0));
+#143=DIRECTION('',(0.0,0.0,-1.0));
+#144=ORIENTED_EDGE('',*,*,#193,.T.);
+#145=ORIENTED_EDGE('',*,*,#189,.F.);
+#146=ORIENTED_EDGE('',*,*,#192,.F.);
+#147=ORIENTED_EDGE('',*,*,#183,.F.);
+#148=CARTESIAN_POINT('',(30.0,5.0,0.0));
+#149=DIRECTION('',(0.0,-1.0,0.0));
+#150=DIRECTION('',(0.0,0.0,-1.0));
+#151=ORIENTED_EDGE('',*,*,#191,.T.);
+#152=ORIENTED_EDGE('',*,*,#186,.F.);
+#153=ORIENTED_EDGE('',*,*,#193,.F.);
+#154=ORIENTED_EDGE('',*,*,#182,.F.);
+#155=CARTESIAN_POINT('',(35.0,0.0,0.0));
+#156=DIRECTION('',(-1.0,0.0,0.0));
+#157=DIRECTION('',(0.0,0.0,1.0));
+#158=ORIENTED_EDGE('',*,*,#194,.F.);
+#159=ORIENTED_EDGE('',*,*,#195,.F.);
+#160=ORIENTED_EDGE('',*,*,#196,.F.);
+#161=ORIENTED_EDGE('',*,*,#197,.F.);
+#162=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#163=DIRECTION('',(0.0,0.0,1.0));
+#164=DIRECTION('',(1.0,0.0,0.0));
+#165=ORIENTED_EDGE('',*,*,#194,.T.);
+#166=ORIENTED_EDGE('',*,*,#198,.F.);
+#167=ORIENTED_EDGE('',*,*,#196,.T.);
+#168=ORIENTED_EDGE('',*,*,#199,.F.);
+#169=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#170=DIRECTION('',(0.0,0.0,1.0));
+#171=DIRECTION('',(1.0,0.0,0.0));
+#172=ORIENTED_EDGE('',*,*,#199,.T.);
+#173=ORIENTED_EDGE('',*,*,#195,.T.);
+#174=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#175=DIRECTION('',(0.0,0.0,-1.0));
+#176=DIRECTION('',(-1.0,0.0,0.0));
+#177=ORIENTED_EDGE('',*,*,#197,.T.);
+#178=ORIENTED_EDGE('',*,*,#198,.T.);
+#179=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#180=DIRECTION('',(0.0,0.0,1.0));
+#181=DIRECTION('',(1.0,0.0,0.0));
+#182=EDGE_CURVE('',#200,#201,#202,.T.);
+#183=EDGE_CURVE('',#201,#203,#204,.T.);
+#184=EDGE_CURVE('',#203,#205,#206,.T.);
+#185=EDGE_CURVE('',#205,#200,#207,.T.);
+#186=EDGE_CURVE('',#208,#209,#210,.T.);
+#187=EDGE_CURVE('',#209,#211,#212,.T.);
+#188=EDGE_CURVE('',#211,#213,#214,.T.);
+#189=EDGE_CURVE('',#213,#208,#215,.T.);
+#190=EDGE_CURVE('',#205,#211,#216,.T.);
+#191=EDGE_CURVE('',#200,#209,#217,.T.);
+#192=EDGE_CURVE('',#203,#213,#218,.T.);
+#193=EDGE_CURVE('',#201,#208,#219,.T.);
+#194=EDGE_CURVE('',#220,#221,#222,.T.);
+#195=EDGE_CURVE('',#223,#220,#224,.T.);
+#196=EDGE_CURVE('',#225,#223,#226,.T.);
+#197=EDGE_CURVE('',#221,#225,#227,.T.);
+#198=EDGE_CURVE('',#225,#221,#228,.T.);
+#199=EDGE_CURVE('',#220,#223,#229,.T.);
+#200=VERTEX_POINT('',#230);
+#201=VERTEX_POINT('',#231);
+#202=LINE('',#232,#233);
+#203=VERTEX_POINT('',#234);
+#204=LINE('',#235,#236);
+#205=VERTEX_POINT('',#237);
+#206=LINE('',#238,#239);
+#207=LINE('',#240,#241);
+#208=VERTEX_POINT('',#242);
+#209=VERTEX_POINT('',#243);
+#210=LINE('',#244,#245);
+#211=VERTEX_POINT('',#246);
+#212=LINE('',#247,#248);
+#213=VERTEX_POINT('',#249);
+#214=LINE('',#250,#251);
+#215=LINE('',#252,#253);
+#216=LINE('',#254,#255);
+#217=LINE('',#256,#257);
+#218=LINE('',#258,#259);
+#219=LINE('',#260,#261);
+#220=VERTEX_POINT('',#262);
+#221=VERTEX_POINT('',#263);
+#222=LINE('',#264,#265);
+#223=VERTEX_POINT('',#266);
+#224=CIRCLE('',#267,5.0);
+#225=VERTEX_POINT('',#268);
+#226=LINE('',#269,#270);
+#227=CIRCLE('',#271,5.0);
+#228=CIRCLE('',#272,5.0);
+#229=CIRCLE('',#273,5.0);
+#230=CARTESIAN_POINT('',(35.0,-5.0,5.0));
+#231=CARTESIAN_POINT('',(35.0,5.0,5.0));
+#232=CARTESIAN_POINT('',(35.0,0.0,5.0));
+#233=VECTOR('',#274,1.0);
+#234=CARTESIAN_POINT('',(25.0,5.0,5.0));
+#235=CARTESIAN_POINT('',(30.0,5.0,5.0));
+#236=VECTOR('',#275,1.0);
+#237=CARTESIAN_POINT('',(25.0,-5.0,5.0));
+#238=CARTESIAN_POINT('',(25.0,0.0,5.0));
+#239=VECTOR('',#276,1.0);
+#240=CARTESIAN_POINT('',(30.0,-5.0,5.0));
+#241=VECTOR('',#277,1.0);
+#242=CARTESIAN_POINT('',(35.0,5.0,-5.0));
+#243=CARTESIAN_POINT('',(35.0,-5.0,-5.0));
+#244=CARTESIAN_POINT('',(35.0,0.0,-5.0));
+#245=VECTOR('',#278,1.0);
+#246=CARTESIAN_POINT('',(25.0,-5.0,-5.0));
+#247=CARTESIAN_POINT('',(30.0,-5.0,-5.0));
+#248=VECTOR('',#279,1.0);
+#249=CARTESIAN_POINT('',(25.0,5.0,-5.0));
+#250=CARTESIAN_POINT('',(25.0,0.0,-5.0));
+#251=VECTOR('',#280,1.0);
+#252=CARTESIAN_POINT('',(30.0,5.0,-5.0));
+#253=VECTOR('',#281,1.0);
+#254=CARTESIAN_POINT('',(25.0,-5.0,0.0));
+#255=VECTOR('',#282,1.0);
+#256=CARTESIAN_POINT('',(35.0,-5.0,0.0));
+#257=VECTOR('',#283,1.0);
+#258=CARTESIAN_POINT('',(25.0,5.0,0.0));
+#259=VECTOR('',#284,1.0);
+#260=CARTESIAN_POINT('',(35.0,5.0,0.0));
+#261=VECTOR('',#285,1.0);
+#262=CARTESIAN_POINT('',(5.0,0.0,-5.0));
+#263=CARTESIAN_POINT('',(5.0,0.0,5.0));
+#264=CARTESIAN_POINT('',(5.0,-6.12303176911189E-16,0.0));
+#265=VECTOR('',#286,1.0);
+#266=CARTESIAN_POINT('',(-5.0,6.12303176911189E-16,-5.0));
+#267=AXIS2_PLACEMENT_3D('',#287,#288,#289);
+#268=CARTESIAN_POINT('',(-5.0,6.12303176911189E-16,5.0));
+#269=CARTESIAN_POINT('',(-5.0,6.12303176911189E-16,0.0));
+#270=VECTOR('',#290,1.0);
+#271=AXIS2_PLACEMENT_3D('',#291,#292,#293);
+#272=AXIS2_PLACEMENT_3D('',#294,#295,#296);
+#273=AXIS2_PLACEMENT_3D('',#297,#298,#299);
+#274=DIRECTION('',(0.0,1.0,0.0));
+#275=DIRECTION('',(-1.0,0.0,0.0));
+#276=DIRECTION('',(0.0,-1.0,0.0));
+#277=DIRECTION('',(1.0,0.0,0.0));
+#278=DIRECTION('',(0.0,-1.0,0.0));
+#279=DIRECTION('',(-1.0,0.0,0.0));
+#280=DIRECTION('',(0.0,1.0,0.0));
+#281=DIRECTION('',(1.0,0.0,0.0));
+#282=DIRECTION('',(0.0,0.0,-1.0));
+#283=DIRECTION('',(0.0,0.0,-1.0));
+#284=DIRECTION('',(0.0,0.0,-1.0));
+#285=DIRECTION('',(0.0,0.0,-1.0));
+#286=DIRECTION('',(0.0,0.0,1.0));
+#287=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#288=DIRECTION('',(0.0,0.0,-1.0));
+#289=DIRECTION('',(1.0,0.0,0.0));
+#290=DIRECTION('',(-0.0,-0.0,-1.0));
+#291=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#292=DIRECTION('',(0.0,0.0,1.0));
+#293=DIRECTION('',(1.0,0.0,0.0));
+#294=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#295=DIRECTION('',(0.0,0.0,1.0));
+#296=DIRECTION('',(1.0,0.0,0.0));
+#297=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#298=DIRECTION('',(0.0,0.0,-1.0));
+#299=DIRECTION('',(1.0,0.0,0.0));
+ENDSEC;
+END-ISO-10303-21;
diff --git a/config/hdf5.m4 b/config/hdf5.m4
index 4d3d11d..b603d24 100644
--- a/config/hdf5.m4
+++ b/config/hdf5.m4
@@ -28,16 +28,17 @@ if test "xyes" != "x$HAVE_LIB_HDF5"; then
HAVE_LIB_HDF5=no
FATHOM_HDF5_LIBS_HELPER
+ FATHOM_HDF5_LIBS_HELPER([-ldl])
if test $HAVE_ZLIB = yes; then
- FATHOM_HDF5_LIBS_HELPER([-lz])
- FATHOM_HDF5_LIBS_HELPER([-lz -lpthread])
+ FATHOM_HDF5_LIBS_HELPER([-lz -ldl])
+ FATHOM_HDF5_LIBS_HELPER([-lz -ldl -lpthread])
fi
if test $HAVE_SZIP = yes; then
- FATHOM_HDF5_LIBS_HELPER([-lsz])
- FATHOM_HDF5_LIBS_HELPER([-lsz -lpthread])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -ldl])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -ldl -lpthread])
if test $HAVE_ZLIB = yes; then
- FATHOM_HDF5_LIBS_HELPER([-lsz -lz])
- FATHOM_HDF5_LIBS_HELPER([-lsz -lz -lpthread])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -lz -ldl])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -lz -ldl -lpthread])
fi
fi
fi
diff --git a/config/netcdf.m4 b/config/netcdf.m4
index 041327d..4c13802 100644
--- a/config/netcdf.m4
+++ b/config/netcdf.m4
@@ -85,33 +85,47 @@ if test "xno" != "x$NETCDF_ARG"; then
NETCDF_CPPFLAGS="-I${NETCDF_ARG}"
fi
fi
-
+
+ AC_PATH_PROG([NC_CONFIG], [nc-config], [no], [${NETCDF_ARG}/bin])
+ if test "$NC_CONFIG" != "no" ; then
+ NETCDF_CPPFLAGS="`$NC_CONFIG --cflags`"
+ NETCDF_LDFLAGS="`$NC_CONFIG --libs`"
+ NETCDF_VERSION="`$NC_CONFIG --version`"
+ AC_SUBST([NETCDF_CPPFLAGS])
+ AC_SUBST([NETCDF_LDFLAGS])
+ AC_SUBST([NETCDF_VERSION])
+ else
+ HAVE_NETCDF=no
+ AC_MSG_WARN("NetCDF configuration utility not found")
+ fi
+
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$NETCDF_CPPFLAGS $CPPFLAGS"
old_LDFLAGS="$LDFLAGS"
- LDFLAGS="$NETCDF_LDFLAGS $HDF5_LDFLAGS $LDFLAGS"
+ LDFLAGS="$NETCDF_LDFLAGS $LDFLAGS"
# Check for C library
AC_LANG_PUSH([C])
AC_CHECK_HEADERS( [netcdf.h],
[FATHOM_CHECK_NETCDF_LIMITS([$1],[$2],[netcdf.h],[NETCDF_SUFFICIENT_DIM_VARS])],
[AC_MSG_WARN([[NetCDF header not found.]]); HAVE_NETCDF=no] )
-
+
# Check if netcdf is usable by itself
+ # AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf"], [NETCDF_LIBS=${NETCDF_LDFLAGS}] )
AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf"], [
- # Check if netcdf is usable with HDF5
+ # Check if netcdf is usable with HDF5
unset ac_cv_lib_netcdf
unset ac_cv_lib_netcdf_nc_create
- # If we haven't already looked for HDF5 libraries, again now incase
- # they're in the NetCDF lib directory.
+ # If we haven't already looked for HDF5 libraries, again now incase
+ # they're in the NetCDF lib directory.
FATHOM_DETECT_HDF5_LIBS
LDFLAGS="$LDFLAGS $HDF5_LDFLAGS"
- AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl"], [
+ AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl $HDF5_LIBS"], [
# Try one more time with HDF5 and libcurl
unset ac_cv_lib_netcdf
unset ac_cv_lib_netcdf_nc_create
- AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl -lcurl"],
- [HAVE_NETCDF=no], [-lhdf5_hl $HDF5_LIBS -lcurl] )],
+ AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl -lcurl "],
+ [HAVE_NETCDF=no], [-lhdf5_hl $HDF5_LIBS -lcurl ] )],
[-lhdf5_hl $HDF5_LIBS] )],
)
diff --git a/configure.ac b/configure.ac
index ea22a5e..29623de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -593,13 +593,14 @@ AC_ARG_WITH( [vtk-lib-suffix],
[case "x$withval" in
xyes)
AC_MSG_ERROR([Must specify a non-empty suffix!])
- VTK_LIB_SUFFIX=
+ VTK_LIB_SUFFIX=
;;
xno)
- VTK_LIB_SUFFIX=
+ AC_MSG_ERROR([Must specify a non-empty suffix!])
+ VTK_LIB_SUFFIX=
;;
x*)
- VTK_LIB_SUFFIX="$withval"
+ VTK_LIB_SUFFIX="$withval"
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-vtk-lib-suffix=\"${withval}\""
;;
esac],[VTK_LIB_SUFFIX=] )
@@ -758,6 +759,40 @@ AC_SUBST(ZOLTAN_INC_FLAGS)
EXPORT_LDFLAGS="$ZOLTAN_LIB_FLAGS $EXPORT_LDFLAGS"
+
+dnl Define a function that checks for the existence of a library
+dnl and if it exists, prepends the corresponding link flag to a
+dnl sepecified variable
+dnl Arguments:
+dnl - The library name
+dnl - The name of the variable to which to prepend the library link flag
+dnl - List of extra libraries required for link test
+dnl - Optional library path linker argument (e.g. -L/opt/foo)
+ AC_DEFUN([FATHOM_CHECK_LIB_LIST],[
+ old_LIBS="$LIBS"
+ LIBS="$5 ${$3} $old_LIBS"
+ AC_HAVE_LIBRARY([$1],[$3="-l$1 ${$3}"],[],[$4])
+ LIBS="$old_LIBS"
+ ])
+
+dnl Define a function that checks for the existence of a library
+dnl and if it exists, prepends the corresponding link flag to a
+dnl sepecified variable
+dnl Arguments:
+dnl - The library name
+dnl - The name of the variable to which to prepend the library link flag
+dnl - List of extra libraries required for link test
+dnl - Optional library path linker argument (e.g. -L/opt/foo)
+ AC_DEFUN([FATHOM_CHECK_VTK_LIB_LIST],[
+ old_LIBS="$LIBS"
+ LIBS="$5 ${$3} $old_LIBS"
+ AC_CHECK_LIB([$1$VTK_LIB_SUFFIX], main,
+ [$3="-l$1$VTK_LIB_SUFFIX ${$3}"],
+ [],[$4])dnl
+ LIBS="$old_LIBS"
+ ])
+
+
################################################################################
# VTK for qvdual and/or vtkMOABReader
################################################################################
@@ -786,7 +821,6 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
AC_LANG_CPLUSPLUS
VTK_INCLUDES=
- VTK_LIB_SUFFIX=-pv3.98
case "x$WITH_VTK" in
xyes|x)
VTK_LIB_DIR=
@@ -806,9 +840,7 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
for dir in /usr/lib/vtk /usr/lib /usr/bin /usr; do
if test "x" = "x$VTK_LIB_DIR"; then
LIBS="$old_LIBS -L$dir"
- unset ac_cv_lib_vtkCommon
- unset ac_cv_lib_vtkCommon_main
- AC_HAVE_LIBRARY([vtkCommonCore$VTK_LIB_SUFFIX],[VTK_LIB_DIR=$dir])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [VTK_LIB_DIR],[],[-L$dir])
fi
done
if test "x" = "x$VTK_LIB_DIR"; then
@@ -828,15 +860,15 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
# Check for non-installed VTK source
AC_CHECK_FILE([vtkUnstructuredGrid.h],[
for subdir in . Common Common/DataModel Filtering GenericFiltering Graphics Hybrid Imaging Parallel Patented Rendering Utilities Utilities/vtkexpat Utilities/expat Utilities/DICOMParser Utilties/vtkpng Utilities/vtkzlib Utilities/freetype/include/freetype Wrapping; do
- AC_MSG_CHECKING([for directory ${WITH_VTK}/$subdir])
- if test -d ${WITH_VTK}/$subdir; then
- VTK_INC_DIR="$VTK_INC_DIR -I${WITH_VTK}/$subdir"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- done
- ],[AC_MSG_ERROR([VTK includes not found])]
+ AC_MSG_CHECKING([for directory ${WITH_VTK}/$subdir])
+ if test -d ${WITH_VTK}/$subdir; then
+ VTK_INC_DIR="$VTK_INC_DIR -I${WITH_VTK}/$subdir"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ done
+ ],[AC_MSG_ERROR([VTK includes not found])]
)
fi
VTK_INCLUDES="$VTK_INC_DIR"
@@ -844,7 +876,7 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
for dir in ${WITH_VTK}/lib ${WITH_VTK}/lib/vtk ${VTK_DIR}/bin ${WITH_VTK}/bin ${WITH_VTK}; do
if test "x" = "x$VTK_LIB_DIR"; then
LIBS="$old_LIBS -L$dir"
- AC_HAVE_LIBRARY([vtkCommonCore$VTK_LIB_SUFFIX],[VTK_LIB_DIR=$dir])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [VTK_LIB_DIR],[],[-L$dir])
fi
done
if test "x" = "x$VTK_LIB_DIR"; then
@@ -853,22 +885,7 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
LIBS="$old_LIBS"
;;
esac
-
-dnl Define a function that checks for the existence of a library
-dnl and if it exists, prepends the corresponding link flag to a
-dnl sepecified variable
-dnl Arguments:
-dnl - The library name
-dnl - The name of the variable to which to prepend the library link flag
-dnl - List of extra libraries required for link test
-dnl - Optional library path linker argument (e.g. -L/opt/foo)
- AC_DEFUN([FATHOM_CHECK_LIB_LIST],[
- old_LIBS="$LIBS"
- LIBS="$5 ${$3} $old_LIBS"
- AC_HAVE_LIBRARY([$1$2],[$3="-l$1$2 ${$3}"],[],[$4])
- LIBS="$old_LIBS"
- ])
-
+
# These are ordered such that a given library depends only on those libraries
# that preceed it in the list.
FATHOM_CHECK_LIB_LIST([pthread],[],[vtk_sys_libs])
@@ -883,27 +900,28 @@ dnl - Optional library path linker argument (e.g. -L/opt/foo)
FATHOM_CHECK_LIB_LIST([GL],[], [vtk_x_libs],[$x_libs_arg],[-L$x_libraries])
FATHOM_CHECK_LIB_LIST([GLU],[], [vtk_x_libs],[$x_libs_arg],[-L$x_libraries])
vtk_libs_arg="-L$x_libraries $vtk_x_libs $X_EXTRA_LIBS -lX11 $X_PRE_LIBS $vtk_sys_libs"
- FATHOM_CHECK_LIB_LIST([vtksys],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkDICOMParser],[$VTK_LIB_SUFFIX],[vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkfreetype],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkexpat],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkzlib],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkpng],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkjpeg],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtktiff],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkftgl],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkFiltering],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkImaging],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([verdict],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkGraphics],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkNetCDF],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkexoIIc],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkmetaio],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkIO],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkRendering],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkParallel],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkHybrid],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+
+ FATHOM_CHECK_VTK_LIB_LIST([vtksys],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkDICOMParser],[$VTK_LIB_SUFFIX],[vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkfreetype],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkexpat],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkzlib],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkpng],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkjpeg],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtktiff],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkftgl],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkFiltersCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkImagingCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([verdict],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkGraphics],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkNetCDF],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkexoIIc],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkmetaio],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkIOCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkRenderingCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkParallelCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ #FATHOM_CHECK_VTK_LIB_LIST([vtkHybrid],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
# Make sure we found at least vtkCommonCore and vtkRendering
if ! echo "x $vtk_libs" | grep lvtkCommonCore >/dev/null; then
@@ -1205,6 +1223,7 @@ AC_CONFIG_FILES([Makefile
src/parallel/Makefile
src/oldinc/Makefile
test/Makefile
+ test/dagmc/Makefile
test/h5file/Makefile
test/dual/Makefile
test/obb/Makefile
diff --git a/examples/CrystalRouterExample.cpp b/examples/CrystalRouterExample.cpp
new file mode 100644
index 0000000..83a1e7c
--- /dev/null
+++ b/examples/CrystalRouterExample.cpp
@@ -0,0 +1,188 @@
+/*
+ * This example will show one of the building blocks of parallel infrastructure in MOAB
+ * More exactly, if we have some homogeneous data to communicate from each processor to a list of other
+ * processors, how do we do it?
+ *
+ * introduce the TupleList and crystal router to MOAB users.
+ *
+ * This technology is used in resolving shared vertices / sets between partitions
+ * It is used in the mbcoupler for sending data (target points) to the proper processor, and communicate
+ * back the results.
+ * Also, it is used to communicate departure mesh for intersection in parallel
+ *
+ * It is a way of doing MPI_gatheralltoallv(), when the communication matrix is sparse
+ *
+ * It is assumed that every proc needs to communicate only with a few of the other processors.
+ * If every processor needs to communicate with all other, then we will have to use paired isend and irecv, the
+ * communication matrix is full
+ *
+ * the example needs to be launched in parallel.
+ * Every proc will build a list of tuples, that will be send to a few procs;
+ * In general, we will send to num_comms tasks, and about num_tuples to each task
+ * We vary num_comms and num_tuples for processor
+ *
+ * we will send long ints of the form
+ * 100000 * send + 1000* rank +j, where j is the index of tuple
+ *
+ * after routing, we verify we received
+ * 100000 * rank + 1000 * from
+ *
+ * For some reportrank we also print the tuples.
+ *
+ * after routing, we will see if we received, as expected. Should run on at least 2 processors.
+ *
+ * Note: We do not need a moab instance for this example
+ *
+ */
+
+/** @example CrystalRouterExample.cpp \n
+ * \brief generalized gather scatter using tuples \n
+ * <b>To run</b>: mpiexec -np <n> CrystalRouterExample -r [reportrank] -t [num_tuples] -n [num_comms] \n
+ *
+ */
+//
+#include "moab/ProcConfig.hpp"
+#include "moab/TupleList.hpp"
+#include "moab/ProgOptions.hpp"
+#include <time.h>
+#include <iostream>
+#include <sstream>
+
+const char BRIEF_DESC[] =
+ "Example of gather scatter with tuple lists \n";
+std::ostringstream LONG_DESC;
+
+using namespace moab;
+using namespace std;
+
+int main(int argc, char **argv)
+{
+ MPI_Init(&argc, &argv);
+
+ ProcConfig pc(MPI_COMM_WORLD);
+ int size = pc.proc_size();
+ int rank = pc.proc_rank();
+
+ // start copy
+ LONG_DESC << "This program does a gather scatter with a list of tuples. \n"
+ " It tries to see how much communication costs in terms of time and memory. \n"
+ << "It starts with creating a list of tuples to be sent from each processor, \n to a list of other processors.\n" <<
+ "The number of tuples and how many tasks to communicate to are controlled by input parameters.\n" <<
+ "After communication, we verify locally if we received what we expected. \n";
+ ProgOptions opts(LONG_DESC.str(), BRIEF_DESC);
+
+ // how many procs communicate to current proc, on average (we will vary that too)
+ int num_comms = 2;
+ opts.addOpt<int>("num_comms,n",
+ "each task will send to about num_comms other tasks some tuples (default 2)", &num_comms);
+
+ int num_tuples = 4;
+ opts.addOpt<int>("num_tuples,t",
+ "each task will send to some task about num_tuples tuples (default 4)", &num_tuples);
+
+ int reportrank = size+1;
+ opts.addOpt<int>("reporting_rank,r",
+ "this rank will report the tuples sent and the tuples received; it could be higher than num_procs, then no reporting"
+ ,&reportrank);
+
+ opts.parseCommandLine(argc, argv);
+
+
+
+
+ if (rank==reportrank || (reportrank>=size && rank == 0))
+ {
+ std::cout << " There are " << size << " tasks in example.\n";
+ std::cout<< " We will send groups of " << num_tuples << " from each task towards " <<
+ num_comms << " other tasks.\n";
+ }
+
+ // send some data from proc i to i+n/2, also to i +n/2+1 modulo n, where n is num procs
+
+ gs_data::crystal_data *cd = pc.crystal_router();
+
+ long total_n_tuples = num_comms*num_tuples;
+
+ // vary the number of tasks to send to, and the number of tuples to send
+ if (rank<size/2)
+ num_comms--;
+ else
+ num_comms++;
+
+ if (rank<size/3)
+ num_tuples*=2;
+ else if (rank>size-size/3)
+ num_tuples/=2;
+
+
+ TupleList tl;
+ // at most num_tuples* num_comms to send
+ // we do a preallocate with this; some tuples on some processors might need more memory, to be able
+ // to grow locally; Some tasks might receive more tuples though, and in the process, some might grow more than
+ // others. By doing these logP sends/receives, we do not grow local memory too much.
+ tl.initialize(1, 1, 0, 1, num_tuples*num_comms);
+ tl.enableWriteAccess();
+ // form num_tuples*num_comms tuples, send to various ranks
+ unsigned int n = tl.get_n();
+ for (int i=0; i<num_comms; i++)
+ {
+ int sendTo = rank+i*size/2+1;// spread out the send to, for a stress-like test
+ sendTo = sendTo%size;//
+ long intToSend = 1000*rank + 100000*sendTo;
+ for (int j=0; j<num_tuples; j++)
+ {
+ n = tl.get_n();
+ tl.vi_wr[n]= sendTo;
+ tl.vl_wr[n]= intToSend+j;
+ tl.vr_wr[n]= 10000.*rank+j;
+ tl.inc_n();
+ }
+ }
+
+ if (rank==reportrank)
+ {
+ std::cout << "rank " << rank << "\n";
+ tl.print(" before sending");
+ }
+
+ clock_t tt = clock();
+ // all communication happens here; no mpi calls for the user
+ ErrorCode rval = cd->gs_transfer(1,tl,0);
+
+ if (MB_SUCCESS!= rval)
+ {
+ std::cout << "error in tuple transfer\n";
+ }
+
+ double secs=0;
+ if (rank==reportrank || (reportrank>=size && rank == 0))
+ {
+ secs = (clock() - tt) / (double) CLOCKS_PER_SEC;
+ }
+ if (rank==reportrank)
+ {
+ std::cout << "rank " << rank << "\n";
+ tl.print(" after transfer");
+ }
+ // check that all tuples received have the form 10000* rank + 100*from
+ unsigned int received = tl.get_n();
+ for (int i=0; i<(int)received; i++)
+ {
+ int from = tl.vi_rd[i];
+ long valrec = tl.vl_rd[i];
+ int remainder = valrec -100000*rank -1000*from;
+ if (remainder < 0 || remainder >= num_tuples*4)
+ std::cout << " error: tuple " << i << " received at proc rank " << rank << " from proc " << from << " has value " <<
+ valrec << " remainder " << remainder << "\n";
+ }
+
+ if (rank==reportrank || (reportrank>=size && rank == 0))
+ {
+ std::cout << "communication of about "<< total_n_tuples << " tuples/per proc took "
+ << secs << " seconds" << std::endl;
+ tt = clock();
+ }
+ MPI_Finalize();
+
+ return 0;
+}
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/fathomteam/moab/commits/8080c75a5090/
Changeset: 8080c75a5090
Branch: None
User: makeclean
Date: 2014-03-27 18:17:26
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 5 files
diff --git a/MeshFiles/unittest/Makefile.am b/MeshFiles/unittest/Makefile.am
index ab3e23e..bc4f522 100644
--- a/MeshFiles/unittest/Makefile.am
+++ b/MeshFiles/unittest/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = io
+SUBDIRS = io dagmc iGeom
EXTRA_DIST = 125hex.g \
16_unmerged_hex.h5m \
diff --git a/MeshFiles/unittest/dagmc/Makefile.am b/MeshFiles/unittest/dagmc/Makefile.am
new file mode 100644
index 0000000..0643ad9
--- /dev/null
+++ b/MeshFiles/unittest/dagmc/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = test_geom.h5m
diff --git a/MeshFiles/unittest/iGeom/Makefile.am b/MeshFiles/unittest/iGeom/Makefile.am
new file mode 100644
index 0000000..203b676
--- /dev/null
+++ b/MeshFiles/unittest/iGeom/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = shell.h5m
diff --git a/configure.ac b/configure.ac
index 29623de..83d8ea5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1255,6 +1255,8 @@ AC_CONFIG_FILES([Makefile
MeshFiles/Makefile
MeshFiles/unittest/Makefile
MeshFiles/unittest/io/Makefile
+ MeshFiles/unittest/iGeom/Makefile
+ MeshFiles/unittest/dagmc/Makefile
])
AC_CONFIG_COMMANDS([src/MOAB_FCDefs.h],
[sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h])
diff --git a/test/dagmc/Makefile.am b/test/dagmc/Makefile.am
index 2ee4a3a..d092176 100644
--- a/test/dagmc/Makefile.am
+++ b/test/dagmc/Makefile.am
@@ -10,11 +10,12 @@ AM_CPPFLAGS += -DSRCDIR=$(srcdir) \
-I$(top_srcdir)/src/io \
-I$(top_srcdir)/src/parallel \
-I$(top_srcdir)/tools/dagmc
-
-TESTS = dagmc_simple_test \
+TESTS =
+if HDF5_FILE
+ TESTS += dagmc_simple_test \
dagmc_rayfire_test \
dagmc_pointinvol_test
-
+endif
check_PROGRAMS = $(TESTS)
dagmc_simple_test_SOURCES = $(srcdir)/../TestUtil.hpp dagmc_simple_test.cpp
https://bitbucket.org/fathomteam/moab/commits/e650361d8a81/
Changeset: e650361d8a81
Branch: None
User: makeclean
Date: 2014-04-22 23:18:45
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 7 files
diff --git a/.gitignore b/.gitignore
index c80a80a..ba9fe1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,6 +127,9 @@ test/bsp_tree_test
test/CMakeLists.txt
test/coords_connect_iterate
test/cropvol_test
+test/dagmc/dagmc_pointinvol_test
+test/dagmc/dagmc_rayfire_test
+test/dagmc/dagmc_simple_test
test/dual/dual_test
test/elem_eval_test
test/file_options_test
@@ -153,8 +156,10 @@ test/io/gmsh_test
test/io/ideas_test
test/io/nastran_test
test/io/read_cgm_basic_test
+test/io/read_cgm_connectivity_test
+test/io/read_cgm_group_test
test/io/read_cgm_load_test
-test/io/read_cgm_test
+test/io/read_cgm_senses_test
test/io/read_mpas_nc
test/io/read_nc
test/io/read_ucd_nc
diff --git a/src/LocalDiscretization/SpectralQuad.cpp b/src/LocalDiscretization/SpectralQuad.cpp
index d7355e6..7b581cb 100644
--- a/src/LocalDiscretization/SpectralQuad.cpp
+++ b/src/LocalDiscretization/SpectralQuad.cpp
@@ -109,7 +109,10 @@ bool SpectralQuad::reverseEvalFcn(const double *posn, const double *verts, const
double dist = opt_findpt_2(&_data, (const double **)_xyz, x_star, r, &c);
// if it did not converge, get out with throw...
if (dist > 0.9e+30)
- throw Map::EvaluationError();
+ {
+ std::vector<CartVect> dummy;
+ throw Map::EvaluationError(CartVect(x_star), dummy);
+ }
//c tells us if we landed inside the element or exactly on a face, edge, or node
// also, dist shows the distance to the computed point.
//copy parametric coords back
diff --git a/src/moab/BoundBox.hpp b/src/moab/BoundBox.hpp
index c74707a..3f1f07f 100644
--- a/src/moab/BoundBox.hpp
+++ b/src/moab/BoundBox.hpp
@@ -14,6 +14,15 @@ namespace moab {
BoundBox(const CartVect &min, const CartVect &max) :
bMin(min), bMax(max) {}
BoundBox(const double *corners);
+ // constructor used in element maps
+ BoundBox(std::vector<CartVect> points): bMin(DBL_MAX), bMax(-DBL_MAX)
+ {
+ for (size_t i=0; i<points.size(); i++)
+ {
+ update_min( points[i].array() );
+ update_max( points[i].array() );
+ }
+ }
~BoundBox() {}
bool contains_point(const double *point, const double tol = 0.0) const;
diff --git a/tools/mbcoupler/Coupler.cpp b/tools/mbcoupler/Coupler.cpp
index afee8af..b868006 100644
--- a/tools/mbcoupler/Coupler.cpp
+++ b/tools/mbcoupler/Coupler.cpp
@@ -758,38 +758,53 @@ ErrorCode Coupler::nat_param(double xyz[3],
std::cout << "Problems getting coordinates of vertices\n";
return result;
}
-
+ CartVect pos(xyz);
if (etype == MBHEX) {
if (8==num_connect)
{
Element::LinearHex hexmap(coords_vert);
- tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
- bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
- if (!inside)
+ if (!hexmap.inside_box( pos, epsilon))
+ continue;
+ try {
+ tmp_nat_coords = hexmap.ievaluate(pos, epsilon);
+ bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
+ if (!inside) continue;
+ }
+ catch (Element::Map::EvaluationError) {
continue;
+ }
}
else if (27==num_connect)
{
Element::QuadraticHex hexmap(coords_vert);
- tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
- bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
- if (!inside)
- continue;
+ if (!hexmap.inside_box( pos, epsilon))
+ continue;
+ try {
+ tmp_nat_coords = hexmap.ievaluate(pos, epsilon);
+ bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
+ if (!inside) continue;
+ }
+ catch (Element::Map::EvaluationError) {
+ continue;
+ }
}
else // TODO this case not treated yet, no interpolation
continue;
}
else if (etype == MBTET){
Element::LinearTet tetmap(coords_vert);
- tmp_nat_coords = tetmap.ievaluate(CartVect(xyz));
+ // this is just a linear solve; unless degenerate, will not except
+ tmp_nat_coords = tetmap.ievaluate(pos);
bool inside = tetmap.inside_nat_space(tmp_nat_coords, epsilon);
if (!inside)
continue;
}
else if (etype == MBQUAD){
Element::LinearQuad quadmap(coords_vert);
+ if (!quadmap.inside_box( pos, epsilon))
+ continue;
try {
- tmp_nat_coords = quadmap.ievaluate(CartVect(xyz), epsilon);
+ tmp_nat_coords = quadmap.ievaluate(pos, epsilon);
bool inside = quadmap.inside_nat_space(tmp_nat_coords, epsilon);
if (!inside) continue;
}
diff --git a/tools/mbcoupler/ElemUtil.cpp b/tools/mbcoupler/ElemUtil.cpp
index cfc36e0..ee338c0 100644
--- a/tools/mbcoupler/ElemUtil.cpp
+++ b/tools/mbcoupler/ElemUtil.cpp
@@ -3,6 +3,7 @@
#include <assert.h>
#include "ElemUtil.hpp"
+#include "moab/BoundBox.hpp"
namespace moab {
namespace ElemUtil {
@@ -433,6 +434,15 @@ namespace Element {
this->vertex = v;
}
+ bool Map::inside_box(const CartVect & xi, double & tol) const
+ {
+ // bail out early, before doing an expensive NR iteration
+ // compute box
+ BoundBox box(this->vertex);
+ return box.contains_point(xi.array(), tol);
+
+ }
+
//
CartVect Map::ievaluate(const CartVect& x, double tol, const CartVect& x0) const {
// TODO: should differentiate between epsilons used for
@@ -448,12 +458,12 @@ namespace Element {
int iters=0;
while (delta % delta > error_tol_sqr) {
if(++iters>10)
- throw Map::EvaluationError();
+ throw Map::EvaluationError(x, vertex);
J = jacobian(xi);
det = J.determinant();
if (det < std::numeric_limits<double>::epsilon())
- throw Map::EvaluationError();
+ throw Map::EvaluationError(x, vertex);
xi -= J.inverse(1.0/det) * delta;
delta = evaluate( xi ) - x;
}
@@ -896,7 +906,10 @@ namespace Element {
real dist = opt_findpt_3(&_data, (const real **)_xyz, x_star, r, &c);
// if it did not converge, get out with throw...
if (dist > 0.9e+30)
- throw Map::EvaluationError();
+ {
+ std::vector<CartVect> dummy;
+ throw Map::EvaluationError(xyz, dummy);
+ }
//c tells us if we landed inside the element or exactly on a face, edge, or node
// also, dist shows the distance to the computed point.
//copy parametric coords back
@@ -1184,7 +1197,11 @@ namespace Element {
real dist = opt_findpt_2(&_data, (const real **)_xyz, x_star, r, &c);
// if it did not converge, get out with throw...
if (dist > 0.9e+30)
- throw Map::EvaluationError();
+ {
+ std::vector<CartVect> dummy;
+ throw Map::EvaluationError(xyz, dummy);
+ }
+
//c tells us if we landed inside the element or exactly on a face, edge, or node
// also, dist shows the distance to the computed point.
//copy parametric coords back
diff --git a/tools/mbcoupler/ElemUtil.hpp b/tools/mbcoupler/ElemUtil.hpp
index 219323b..b2a743a 100644
--- a/tools/mbcoupler/ElemUtil.hpp
+++ b/tools/mbcoupler/ElemUtil.hpp
@@ -103,10 +103,22 @@ namespace ElemUtil {
/**\brief Set vertices. */
virtual void set_vertices(const std::vector<CartVect>& v);
+ // will look at the box formed by vertex coordinates, and before doing any NR, bail out if necessary
+ virtual bool inside_box(const CartVect & xi, double & tol) const;
+
/* Exception thrown when an evaluation fails (e.g., ievaluate fails to converge). */
class EvaluationError {
public:
- EvaluationError(){};
+ EvaluationError(const CartVect & x, const std::vector<CartVect> & verts): p(x), vertices(verts){
+#ifndef NDEBUG
+ std::cout << "p:" << p << "\n vertices.size() " <<vertices.size() << "\n";
+ for (size_t i=0; i<vertices.size(); i++)
+ std::cout << vertices[i] << "\n";
+#endif
+ };
+ private:
+ CartVect p;
+ std::vector<CartVect> vertices;
};// class EvaluationError
/* Exception thrown when a bad argument is encountered. */
diff --git a/tools/mbcoupler/ElementTest.cpp b/tools/mbcoupler/ElementTest.cpp
index 4f37602..ca6e9e2 100644
--- a/tools/mbcoupler/ElementTest.cpp
+++ b/tools/mbcoupler/ElementTest.cpp
@@ -24,7 +24,58 @@ void test_tet() {
}// test_tet()
void test_hex() {
- moab::Element::LinearHex hex;
+ double positions[] =
+ {
+ 236.80706050970281, -139.55422526228017, 193.27999999999997,
+ 236.47511729348639, -141.33020962638582, 193.27999999999997,
+ 237.8457938295229, -142.57076074835663, 193.27999999999997,
+ 239.12702305519684, -139.96608933577852, 193.27999999999997,
+ 236.80841321361444, -139.55341321335499, 202.654,
+ 236.47655014713746, -141.32980272396816, 202.654,
+ 237.8477913707564, -142.57047282187165, 202.654,
+ 239.12865103844533, -139.96531051891105, 202.654
+ };
+ CartVect x(235.96518686964933, -142.43503000077749, 188.19999999999987);
+ std::vector<CartVect> vertices;
+ for (int i=0; i<8; i++)
+ vertices.push_back(CartVect(positions+3*i));
+
+ moab::Element::LinearHex hex(vertices);
+ double tol(0.0001);
+ if (hex.inside_box(x, tol))
+ {
+ CartVect nat_par = hex.ievaluate(x, 0.0001);
+ std::cout <<nat_par <<"\n";
+ }
+
+ double positions2[] =
+ { 49.890500000000024, -20.376134375374882, 312.72000000000003,
+ 52.015875000000044, -19.149048546996006, 312.72000000000003,
+ 48.430375821458099, -18.548796774572125, 312.72000000000003,
+ 47.717616239031223, -21.191360829777231, 312.72000000000003,
+ 49.890500000000024, -20.376134375374882, 322.88,
+ 52.015875000000044, -19.149048546996006, 322.88,
+ 48.429930354643275, -18.52828610485021, 322.88,
+ 47.720552036968819, -21.167591146685712, 322.88};
+
+ CartVect x2(51.469000000000015, -20.145482942833631, 317.80000000000001);
+
+ vertices.clear();
+ for (int i=0; i<8; i++)
+ vertices.push_back(CartVect(positions2+3*i));
+ moab::Element::LinearHex hex2(vertices);
+ if (hex2.inside_box(x2, tol))
+ {
+ try {
+ CartVect nat_par = hex.ievaluate(x, 0.0001);
+ std::cout <<nat_par <<"\n";
+ }
+ catch (Element::Map::EvaluationError) {
+ // nothing
+ }
+}
+
+
}// test_hex()
#include "moab/Core.hpp"
#include "moab/Range.hpp"
https://bitbucket.org/fathomteam/moab/commits/da818c959e0a/
Changeset: da818c959e0a
Branch: None
User: makeclean
Date: 2014-05-29 23:22:55
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 63 files
diff --git a/.gitignore b/.gitignore
index ba9fe1e..52e35a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -97,9 +97,9 @@ Makefile
Makefile.in
moab.config
MOABConfig.cmake
-moab.creator*
-moab.files
-moab.includes
+*.creator*
+*.files
+*.includes
moab.make
*.o
.project
@@ -151,15 +151,18 @@ test/io/*.ccmg
test/io/ccmio_test
test/io/cub_file_test
test/io/exodus_test
+test/io/*.h5m
test/io/*.g
test/io/gmsh_test
test/io/ideas_test
test/io/nastran_test
+test/io/*.nc
test/io/read_cgm_basic_test
test/io/read_cgm_connectivity_test
test/io/read_cgm_group_test
test/io/read_cgm_load_test
test/io/read_cgm_senses_test
+test/io/read_gcrm_nc
test/io/read_mpas_nc
test/io/read_nc
test/io/read_ucd_nc
@@ -168,6 +171,7 @@ test/io/smf_test
test/io/stl_test
test/io/tqdcfr
test/io/vtk_test
+test/io/write_nc
test/kd_tree_test
test/kd_tree_time
test/kd_tree_tool
@@ -183,10 +187,12 @@ test/obb/obb_time
test/obb/obb_tree_tool
test/obb_test
test/oldinc/test_oldinc
+test/parallel/gcrm_par
test/parallel/*.h5m
test/parallel/mbparallelcomm_test
test/parallel/mhdf_parallel
test/parallel/mpastrvpart
+test/parallel/*.nc
test/parallel/par_coupler_test
test/parallel/par_intx_sph
test/parallel/parallel_hdf5_test
@@ -206,6 +212,7 @@ test/parallel/structured3
test/parallel/uber_parallel_test
test/parallel/ucdtrvpart
test/parallel/*.vtk
+test/parallel/write_nc_par
test/perf/adj_time
test/perf/perf
test/perf/perftool
diff --git a/MeshFiles/unittest/io/Makefile.am b/MeshFiles/unittest/io/Makefile.am
index 3b767aa..94704c1 100644
--- a/MeshFiles/unittest/io/Makefile.am
+++ b/MeshFiles/unittest/io/Makefile.am
@@ -2,7 +2,10 @@ EXTRA_DIST = HommeMapping.nc \
brick_cubit10.1.cub \
brick_cubit10.2.cub \
brick_cubit10.cub \
- camEul26x48x96.t3.nc \
+ eul26x48x96.t0.nc \
+ eul26x48x96.t1.nc \
+ eul26x48x96.t2.nc \
+ eul26x48x96.t.3.nc \
fv26x46x72.t.3.nc \
cubtest12.cub \
cubtest14.cub \
@@ -22,6 +25,10 @@ EXTRA_DIST = HommeMapping.nc \
sample.stl \
three.smf \
mpasx1.642.t.2.nc \
- 2d_naca0012.cgns
-
+ 2d_naca0012.cgns \
+ cube.sat \
+ cube.stp \
+ cylcube.sat \
+ cylcube.stp \
+ gcrm_r3.nc
diff --git a/MeshFiles/unittest/io/camEul26x48x96.t3.nc b/MeshFiles/unittest/io/camEul26x48x96.t3.nc
deleted file mode 100644
index fafba2a..0000000
Binary files a/MeshFiles/unittest/io/camEul26x48x96.t3.nc and /dev/null differ
diff --git a/MeshFiles/unittest/io/eul26x48x96.t.3.nc b/MeshFiles/unittest/io/eul26x48x96.t.3.nc
new file mode 100644
index 0000000..fafba2a
Binary files /dev/null and b/MeshFiles/unittest/io/eul26x48x96.t.3.nc differ
diff --git a/MeshFiles/unittest/io/eul26x48x96.t0.nc b/MeshFiles/unittest/io/eul26x48x96.t0.nc
new file mode 100644
index 0000000..453105a
Binary files /dev/null and b/MeshFiles/unittest/io/eul26x48x96.t0.nc differ
diff --git a/MeshFiles/unittest/io/eul26x48x96.t1.nc b/MeshFiles/unittest/io/eul26x48x96.t1.nc
new file mode 100644
index 0000000..61a7c8f
Binary files /dev/null and b/MeshFiles/unittest/io/eul26x48x96.t1.nc differ
diff --git a/MeshFiles/unittest/io/eul26x48x96.t2.nc b/MeshFiles/unittest/io/eul26x48x96.t2.nc
new file mode 100644
index 0000000..239bd83
Binary files /dev/null and b/MeshFiles/unittest/io/eul26x48x96.t2.nc differ
diff --git a/MeshFiles/unittest/io/gcrm_r3.nc b/MeshFiles/unittest/io/gcrm_r3.nc
new file mode 100644
index 0000000..6d1b8d2
Binary files /dev/null and b/MeshFiles/unittest/io/gcrm_r3.nc differ
diff --git a/examples/ReadWriteTest.cpp b/examples/ReadWriteTest.cpp
new file mode 100644
index 0000000..3ae6567
--- /dev/null
+++ b/examples/ReadWriteTest.cpp
@@ -0,0 +1,112 @@
+/** @example ReadWriteTest.cpp \n
+ * \brief Read mesh into MOAB and write some back \n
+ *
+ * <b>To run</b>: mpiexec -np 4 ReadWriteTest [input] [output] -O <read_opts> -o <write_opts>\n
+ *
+ * used for stress test of reader/writer
+ * report times to read and write
+ *
+ * example ReadWriteTest ../MeshFiles/io/fv26x46x72.t.3.nc out.nc \
+ * -O PARALLEL=READ_PART;PARTITION_METHOD=SQIJ;PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE=T,U; \
+ * -o PARALLEL=WRITE_PART;VARIABLE=T,U
+ */
+
+#include "moab/ParallelComm.hpp"
+#include "MBParallelConventions.h"
+#include "moab/Core.hpp"
+#include <iostream>
+#include <time.h>
+
+using namespace moab;
+using namespace std;
+
+
+int main(int argc, char **argv)
+{
+ MPI_Init(&argc, &argv);
+
+ string options;
+
+ // Need option handling here for input filename
+ if (argc < 3 ){
+ return 1;
+ }
+
+ char * input_file = argv[1];
+ char * output_file = argv[2];
+ char * read_opts = NULL;
+ char * write_opts = NULL; // tags to write, separated by commas; it is the name of the tag
+
+ if (argc>3)
+ {
+ int index=3;
+ while (index<argc)
+ {
+ if (!strcmp( argv[index], "-O")) // this is for reading options, optional
+ {
+ read_opts=argv[++index];
+ }
+ if (!strcmp( argv[index], "-o"))
+ {
+ write_opts=argv[++index];
+ }
+ index++;
+ }
+ }
+
+
+ // Get MOAB instance and read the file with the specified options
+ Interface* mb = new Core;
+ if (NULL == mb)
+ return 1;
+
+ // Get the ParallelComm instance
+ ParallelComm* pcomm = new ParallelComm(mb, MPI_COMM_WORLD);
+ int nprocs = pcomm->proc_config().proc_size();
+ int rank = pcomm->proc_config().proc_rank();
+
+
+ EntityHandle set;
+ ErrorCode rval = mb->create_meshset(MESHSET_SET, set);
+
+ clock_t tt = clock();
+
+ if (rank == 0)
+ cout << "Reading file " << input_file << "\n with options: " << read_opts << endl
+ << " on " << nprocs << " processors\n";
+
+ rval = mb->load_file(input_file, &set, read_opts);
+ if (rval != MB_SUCCESS) {
+ delete mb;
+ return 1;
+ }
+
+ if (0==rank)
+ {
+ std::cout << "Time: "
+ << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+ tt = clock();
+ }
+
+ rval = mb->write_file(output_file, 0, write_opts, &set, 1);
+ if (rval != MB_SUCCESS)
+ {
+ delete mb;
+ return 1;
+ }
+
+ if (0 == rank)
+ {
+ cout << "Writing file " << output_file << "\n with options: " << write_opts << endl;
+ cout << "Time: " << (clock() - tt) / (double) CLOCKS_PER_SEC
+ << " seconds" << std::endl;
+ tt = clock();
+ }
+
+
+ delete mb;
+
+ MPI_Finalize();
+
+ return 0;
+}
diff --git a/examples/VisTags.cpp b/examples/VisTags.cpp
new file mode 100644
index 0000000..efba608
--- /dev/null
+++ b/examples/VisTags.cpp
@@ -0,0 +1,181 @@
+/** @example VisTags.cpp \n
+ * \brief tool for visualizing multi level tags \n
+ * <b>To run</b>: VisTags <inp_file><outfile> -O <read_opts> -t <tags> -l <levels> -d <dim> \n
+ *
+ * In this example, it is shown how to create some simple tags for those tags that come from
+ * climate data, multiple levels.
+ * you can read directly nc data, or *.h5m file that will have the tag with multi levels
+ * output will be a vtk file with dense tags of form tag_name_<level>
+ * the tag name might contain a time index too, like T0 or U0
+ * <tag> is a list of tags, separated by commas, no spaces
+ * <levels> is a list of levels, separated by commas, no spaces
+ * dimension of entities with the tags will be specified with -d (default 2)
+ *
+ * an example of use
+ *
+ * VisTags gcrm_rc.nc out.vtk -O VARIABLE=u -t u0,u1 -l 0,1,2 -d 2
+ * (we knew that it had variable u in the file, that it had 256 levels, that there are 2 time
+ * steps, etc)
+ *
+ * or
+ * VisTags gcrm_rc.nc out.vtk -t u0 -l 0,1,2 -d 2
+ * (it will read all variables, but we need to know that u0 will be created as a tag)
+ *
+ * the out.vtk file will contain u0_0, u0_1, as simple dense double tags
+ */
+
+#include <iostream>
+#include <vector>
+#include <sstream>
+#include <string>
+
+// Include header for MOAB instance and tag conventions for
+#include "moab/Core.hpp"
+#include "MBTagConventions.hpp"
+#include "moab/FileOptions.hpp"
+
+
+int main(int argc, char **argv) {
+
+ // instantiate & load a file
+ moab::Interface *mb = new moab::Core();
+
+ moab::ErrorCode rval;
+ if (argc <= 1)
+ return 0;
+
+ int dimension = 2;
+ char * file_input = argv[1];
+ char * file_output = argv[2];
+ char * read_opts = NULL;
+ char * tags = NULL; // tags to write, separated by commas; it is the name of the tag
+ // in moab, it may have index after reading (T0, T1, etc)
+ char * levels = NULL; // levels, separated by commas, no spaces ( like 0,1,19 )
+ if (argc>3)
+ {
+ int index=3;
+ while (index<argc)
+ {
+ if (!strcmp( argv[index], "-O")) // this is for reading options, optional
+ {
+ read_opts=argv[++index];
+ }
+ if (!strcmp( argv[index], "-t"))
+ {
+ tags=argv[++index];
+ }
+ if (!strcmp( argv[index], "-l"))
+ {
+ levels=argv[++index];
+ }
+ if (!strcmp( argv[index], "-d"))
+ {
+ dimension=atoi(argv[++index]);
+ }
+ index++;
+ }
+ }
+ std::ostringstream opts;
+ opts << ";;TAGS=" << tags << ";LEVELS=" << levels << "\0" ;
+ moab::FileOptions fo(opts.str().c_str());
+
+ std::vector<std::string> tagsNames;
+ std::vector<int> levelsArray;
+ fo.get_strs_option("TAGS", tagsNames);
+ fo.get_ints_option("LEVELS", levelsArray);
+
+ // now create double tags for entities of dimension
+
+ rval = mb->load_file(file_input, 0, read_opts);
+ if (rval != moab::MB_SUCCESS) {
+ std::cout <<"not loading file\n";
+ return 1;
+ }
+ moab::Range ents;
+ rval = mb->get_entities_by_dimension(0, dimension, ents);
+ if (rval != moab::MB_SUCCESS) {
+ std::cout <<"not getting ents\n";
+ return 1;
+ }
+ for (size_t i=0; i<tagsNames.size(); i++)
+ {
+ std::string tagName = tagsNames[i];
+ moab::Tag tagh;
+ rval = mb->tag_get_handle(tagName.c_str(), tagh);
+
+ if (rval != moab::MB_SUCCESS) {
+ std::cout <<"not getting tag " << tagName.c_str()<<"\n";
+ continue;
+ }
+ int len=0;
+ rval = mb->tag_get_length(tagh, len);
+ if (rval != moab::MB_SUCCESS) {
+ std::cout <<"not getting tag len" << tagName.c_str()<<"\n";
+ continue;
+ }
+ moab::DataType type;
+ rval = mb->tag_get_data_type(tagh, type) ;
+ if (rval != moab::MB_SUCCESS) {
+ std::cout <<"not getting tag type " << tagName.c_str()<<"\n";
+ continue;
+ }
+ int count;
+ void * dataptr;// assume double tags, for simplicity
+ rval = mb->tag_iterate( tagh,
+ ents.begin(),
+ ents.end(),
+ count,
+ dataptr);
+ if (rval != moab::MB_SUCCESS || count != (int)ents.size()) {
+ std::cout <<"not getting tag iterate right " << tagName.c_str()<<"\n";
+ continue;
+ }
+
+ // now create a new tag, with a new name, concatenated, and copy data there , for each level
+ for (size_t j=0; j<levelsArray.size();j++)
+ {
+ int level=levelsArray[j];
+ if (level >= len)
+ {
+ std::cout << "level too big at "<< level << "\n";
+ continue;
+ }
+ std::ostringstream newTagName;
+ newTagName << tagName <<"_" << level ;
+ moab::Tag newTagh;
+ rval = mb->tag_get_handle(newTagName.str().c_str(), 1, type, newTagh,
+ moab::MB_TAG_DENSE | moab::MB_TAG_CREAT);
+ if (rval != moab::MB_SUCCESS ) {
+ std::cout <<"not getting new tag " << newTagName.str() <<"\n";
+ continue;
+ }
+ void * newDataPtr;
+ rval = mb->tag_iterate( newTagh,
+ ents.begin(),
+ ents.end(),
+ count,
+ newDataPtr);
+ if (rval != moab::MB_SUCCESS || count !=(int) ents.size()) {
+ std::cout <<"not getting new tag iterate" << newTagName.str() <<"\n";
+ continue;
+ }
+ if (type==moab::MB_TYPE_DOUBLE)
+ {
+ double * ptrD = (double*) newDataPtr;
+ double *oldData = (double*)dataptr;
+ for (int k=0; k<count; k++, ptrD++)
+ {
+ *ptrD = oldData[level+count*k];
+ }
+ }
+ }
+ mb->tag_delete(tagh);// no need for the tag anymore, write it to the new file
+ }
+
+ rval = mb->write_file(file_output);
+ if (rval != moab::MB_SUCCESS)
+ std::cout <<"can't write file " << file_output << "\n";
+ else
+ std::cout <<"successfully wrote file " << file_output<< "\n";
+ return 0;
+}
diff --git a/examples/makefile b/examples/makefile
index 41dc577..787c8d3 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -65,6 +65,12 @@ PushParMeshIntoMoabF90: PushParMeshIntoMoabF90.o
DeformMeshRemap: DeformMeshRemap.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} -lmbcoupler ${MOAB_LIBS_LINK}
+VisTags: VisTags.o ${MOAB_LIBDIR}/libMOAB.la
+ ${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
+ReadWriteTest: ReadWriteTest.o ${MOAB_LIBDIR}/libMOAB.la
+ ${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
clean:
rm -rf *.o *.mod *.h5m ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
diff --git a/itaps/igeom/testSmooth2.cc b/itaps/igeom/testSmooth2.cc
index 7e4fbf4..e6f678b 100644
--- a/itaps/igeom/testSmooth2.cc
+++ b/itaps/igeom/testSmooth2.cc
@@ -173,11 +173,14 @@ int main(int argc, char *argv[]) {
iBase_EntitySetHandle root_set;
iMesh_createEntSet(mesh, 0, &root_set, &err);
- CHECK( "Failed to create a model root set.\n");
+ if (err != iBase_SUCCESS)
+ std::cerr << " Error code: " << err << " failed to create a model set"
+ << " At : " << __FILE__ << ':' << __LINE__ << std::endl;
iMesh_load(mesh, root_set, filename.c_str(), NULL, &err, filename.length(), 0);
- CHECK( "Failed to create a model root set.\n");
-
+ if (err != iBase_SUCCESS)
+ std::cerr << " Error code: " << err << " failed load the file"
+ << " At : " << __FILE__ << ':' << __LINE__ << std::endl;
std::string opts("SMOOTH;");
// new constructor
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 40f7a59..5b5cd8f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -73,7 +73,6 @@
io/GmshUtil.cpp
io/ReadABAQUS.cpp
io/ReadGmsh.cpp
- io/ReadGCRM.cpp
io/ReadIDEAS.cpp
io/ReadMCNP5.cpp
io/ReadNASTRAN.cpp
@@ -132,6 +131,7 @@
io/NCHelperFV.cpp
io/NCHelperHOMME.cpp
io/NCHelperMPAS.cpp
+ io/NCHelperGCRM.cpp
SpectralMeshTool.cpp
)
include_directories(
diff --git a/src/ReaderWriterSet.cpp b/src/ReaderWriterSet.cpp
index 5015a7f..47c4c2b 100644
--- a/src/ReaderWriterSet.cpp
+++ b/src/ReaderWriterSet.cpp
@@ -48,15 +48,14 @@
#ifdef NETCDF_FILE
# include "ReadNCDF.hpp"
# include "WriteNCDF.hpp"
+# include "WriteNC.hpp"
# include "WriteSLAC.hpp"
# include "ReadNC.hpp"
-# include "ReadGCRM.hpp"
#endif
// 2nd include of ReadNC in case we have pnetcdf and not netcdf
#ifdef PNETCDF_FILE
# include "ReadNC.hpp"
-# include "ReadGCRM.hpp"
#endif
#ifdef CGNS_FILE
@@ -104,8 +103,7 @@ ReaderWriterSet::ReaderWriterSet( Core* mdb, Error* handler )
#ifdef NETCDF_FILE
const char* exo_sufxs[] = { "exo", "exoII", "exo2", "g", "gen", NULL };
register_factory( ReadNCDF::factory, WriteNCDF::factory, "Exodus II", exo_sufxs, "EXODUS" );
- register_factory( ReadGCRM::factory, NULL, "GCRM NC", "nc", "GCRM" );
- register_factory( ReadNC::factory, NULL, "Climate NC", "nc", "NC" );
+ register_factory( ReadNC::factory, WriteNC::factory, "Climate NC", "nc", "NC" );
#endif
#ifdef CGNS_FILE
diff --git a/src/TupleList.cpp b/src/TupleList.cpp
index 113e826..095a01d 100644
--- a/src/TupleList.cpp
+++ b/src/TupleList.cpp
@@ -267,7 +267,7 @@ int TupleList::find(unsigned int key_num, sint value)
else
{
// Sequential search: if tuple_list is not sorted
- for (long index = 0; index < n; index++)
+ for (uint index = 0; index < n; index++)
{
if (vi[index * mi + key_num] == (long) uvalue)
return index;
diff --git a/src/io/Makefile.am b/src/io/Makefile.am
index 09fe3d3..2d2d60b 100644
--- a/src/io/Makefile.am
+++ b/src/io/Makefile.am
@@ -17,12 +17,19 @@ if NETCDF_FILE
WriteNCDF.cpp WriteNCDF.hpp \
WriteSLAC.cpp WriteSLAC.hpp \
ReadNC.cpp ReadNC.hpp \
+ WriteNC.cpp WriteNC.hpp \
NCHelper.cpp NCHelper.hpp \
NCHelperEuler.cpp NCHelperEuler.hpp \
NCHelperFV.cpp NCHelperFV.hpp \
NCHelperHOMME.cpp NCHelperHOMME.hpp \
NCHelperMPAS.cpp NCHelperMPAS.hpp \
- ReadGCRM.cpp ReadGCRM.hpp
+ NCHelperGCRM.cpp NCHelperGCRM.hpp \
+ NCWriteHelper.cpp NCWriteHelper.hpp \
+ NCWriteEuler.cpp NCWriteEuler.hpp \
+ NCWriteFV.cpp NCWriteFV.hpp \
+ NCWriteHOMME.cpp NCWriteHOMME.hpp \
+ NCWriteMPAS.cpp NCWriteMPAS.hpp \
+ NCWriteGCRM.cpp NCWriteGCRM.hpp
else
MOAB_NETCDF_SRCS =
endif
@@ -30,12 +37,19 @@ endif
if PNETCDF_FILE
if !NETCDF_FILE
MOAB_NETCDF_SRCS += ReadNC.cpp ReadNC.hpp \
+ WriteNC.cpp WriteNC.hpp \
NCHelper.cpp NCHelper.hpp \
NCHelperEuler.cpp NCHelperEuler.hpp \
NCHelperFV.cpp NCHelperFV.hpp \
NCHelperHOMME.cpp NCHelperHOMME.hpp \
NCHelperMPAS.cpp NCHelperMPAS.hpp \
- ReadGCRM.cpp ReadGCRM.hpp
+ NCHelperGCRM.cpp NCHelperGCRM.hpp \
+ NCWriteHelper.cpp NCWriteHelper.hpp \
+ NCWriteEuler.cpp NCWriteEuler.hpp \
+ NCWriteFV.cpp NCWriteFV.hpp \
+ NCWriteHOMME.cpp NCWriteHOMME.hpp \
+ NCWriteMPAS.cpp NCWriteMPAS.hpp \
+ NCWriteGCRM.cpp NCWriteGCRM.hpp
endif
endif
diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 9ef1332..950d20c 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -3,6 +3,7 @@
#include "NCHelperFV.hpp"
#include "NCHelperHOMME.hpp"
#include "NCHelperMPAS.hpp"
+#include "NCHelperGCRM.hpp"
#include <sstream>
@@ -51,13 +52,17 @@ NCHelper* NCHelper::get_nc_helper(ReadNC* readNC, int fileId, const FileOptions&
// For a HOMME connectivity file, there might be no CF convention
else if (NCHelperHOMME::can_read_file(readNC, fileId))
return new (std::nothrow) NCHelperHOMME(readNC, fileId, opts, fileSet);
+ // gcrm reader
+ else if (NCHelperGCRM::can_read_file(readNC))
+ return new (std::nothrow) NCHelperGCRM(readNC, fileId, opts, fileSet);
}
// Unknown NetCDF grid (will fill this in later for POP, CICE and CLM)
return NULL;
}
-ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums) {
+ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
+{
Interface*& mbImpl = _readNC->mbImpl;
std::vector<std::string>& dimNames = _readNC->dimNames;
std::vector<int>& dimLens = _readNC->dimLens;
@@ -192,16 +197,16 @@ ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
unsigned int varDimSz = varInfo[mapIter->first].varDims.size();
if (varDimSz == 0)
continue;
- varInfo[mapIter->first].varTags.resize(varDimSz, 0);
+ std::vector<Tag> varDimTags(varDimSz);
for (unsigned int i = 0; i != varDimSz; i++) {
Tag tmptag = 0;
std::string tmptagname = dimNames[varInfo[mapIter->first].varDims[i]];
mbImpl->tag_get_handle(tmptagname.c_str(), 0, MB_TYPE_OPAQUE, tmptag, MB_TAG_ANY);
- varInfo[mapIter->first].varTags[i] = tmptag;
+ varDimTags[i] = tmptag;
}
rval = mbImpl->tag_get_handle(tag_name.c_str(), varDimSz, MB_TYPE_HANDLE, varNamesDimsTag, MB_TAG_SPARSE | MB_TAG_CREAT);
ERRORR(rval, "Trouble creating __<var_name>_DIMS tag.");
- rval = mbImpl->tag_set_data(varNamesDimsTag, &_fileSet, 1, &(varInfo[mapIter->first].varTags[0]));
+ rval = mbImpl->tag_set_data(varNamesDimsTag, &_fileSet, 1, &(varDimTags[0]));
ERRORR(rval, "Trouble setting data for __<var_name>_DIMS tag.");
if (MB_SUCCESS == rval)
dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -252,21 +257,37 @@ ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
Tag varAttTag = 0;
rval = mbImpl->tag_get_handle(tag_name.c_str(), 0, MB_TYPE_OPAQUE, varAttTag, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
ERRORR(rval, "Trouble creating __<var_name>_ATTRIBS tag.");
+
std::string varAttVal;
std::vector<int> varAttLen;
- rval = create_attrib_string(mapIter->second.varAtts, varAttVal, varAttLen);
- ERRORR(rval, "Trouble creating attribute strings.");
+ if (mapIter->second.numAtts < 1) {
+ if (dummyVarNames.find(mapIter->first) != dummyVarNames.end()) {
+ // This variable is a dummy coordinate variable
+ varAttVal = "DUMMY_VAR";
+ }
+ else {
+ // This variable has no attributes
+ varAttVal = "NO_ATTRIBS";
+ }
+ }
+ else {
+ rval = create_attrib_string(mapIter->second.varAtts, varAttVal, varAttLen);
+ ERRORR(rval, "Trouble creating attribute string.");
+ }
const void* varAttPtr = varAttVal.c_str();
int varAttSz = varAttVal.size();
+ if (0 == varAttSz)
+ varAttSz = 1;
rval = mbImpl->tag_set_by_ptr(varAttTag, &_fileSet, 1, &varAttPtr, &varAttSz);
ERRORR(rval, "Trouble setting data for __<var_name>_ATTRIBS tag.");
if (MB_SUCCESS == rval)
dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
- if (varAttLen.size() == 0)
- varAttLen.push_back(0);
+
ssTagName << "_LEN";
tag_name = ssTagName.str();
Tag varAttLenTag = 0;
+ if (0 == varAttLen.size())
+ varAttLen.push_back(0);
rval = mbImpl->tag_get_handle(tag_name.c_str(), varAttLen.size(), MB_TYPE_INTEGER, varAttLenTag, MB_TAG_SPARSE | MB_TAG_CREAT);
ERRORR(rval, "Trouble creating __<var_name>_ATTRIBS_LEN tag.");
rval = mbImpl->tag_set_data(varAttLenTag, &_fileSet, 1, &varAttLen[0]);
@@ -307,10 +328,64 @@ ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
return MB_SUCCESS;
}
+ErrorCode NCHelper::update_time_tag_vals()
+{
+ Interface*& mbImpl = _readNC->mbImpl;
+ std::vector<std::string>& dimNames = _readNC->dimNames;
+
+ ErrorCode rval;
+
+ // The time tag might be a dummy one (e.g. 'Time' for MPAS)
+ std::string time_tag_name = dimNames[tDim];
+ if (dummyVarNames.find(time_tag_name) != dummyVarNames.end())
+ return MB_SUCCESS;
+
+ Tag time_tag = 0;
+ const void* data = NULL;
+ int time_tag_size = 0;
+ rval = mbImpl->tag_get_handle(time_tag_name.c_str(), 0, MB_TYPE_DOUBLE, time_tag, MB_TAG_VARLEN);
+ ERRORR(rval, "Trouble getting time tag.");
+ rval = mbImpl->tag_get_by_ptr(time_tag, &_fileSet, 1, &data, &time_tag_size);
+ ERRORR(rval, "Trouble getting values for time tag.");
+ const double* time_tag_vals = static_cast<const double*>(data);
+
+ // Merge tVals (read from current file) to existing time tag
+ // Assume that time_tag_vals and tVals are both sorted
+ std::vector<double> merged_time_vals;
+ merged_time_vals.reserve(time_tag_size + nTimeSteps);
+ int i = 0;
+ int j = 0;
+
+ // Merge time values from time_tag_vals and tVals
+ while (i < time_tag_size && j < nTimeSteps) {
+ if (time_tag_vals[i] < tVals[j])
+ merged_time_vals.push_back(time_tag_vals[i++]);
+ else
+ merged_time_vals.push_back(tVals[j++]);
+ }
+
+ // Append remaining time values of time_tag_vals (if any)
+ while (i < time_tag_size)
+ merged_time_vals.push_back(time_tag_vals[i++]);
+
+ // Append remaining time values of tVals (if any)
+ while (j < nTimeSteps)
+ merged_time_vals.push_back(tVals[j++]);
+
+ data = &merged_time_vals[0];
+ time_tag_size = merged_time_vals.size();
+ rval = mbImpl->tag_set_by_ptr(time_tag, &_fileSet, 1, &data, &time_tag_size);
+ ERRORR(rval, "Failed to set data for time tag.");
+
+ return MB_SUCCESS;
+}
+
ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std::vector<int>& tstep_nums,
std::vector<ReadNC::VarData>& vdatas, std::vector<ReadNC::VarData>& vsetdatas)
{
std::map<std::string, ReadNC::VarData>& varInfo = _readNC->varInfo;
+ std::vector<std::string>& dimNames = _readNC->dimNames;
+
std::map<std::string, ReadNC::VarData>::iterator mit;
// If empty read them all (except ignored variables)
@@ -319,11 +394,13 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
ReadNC::VarData vd = (*mit).second;
// If read all variables at once, skip ignored ones
- // Upon creation of dummy variables, tag values have already been set
- if (ignoredVarNames.find(vd.varName) != ignoredVarNames.end() ||
- dummyVarNames.find(vd.varName) != dummyVarNames.end())
+ if (ignoredVarNames.find(vd.varName) != ignoredVarNames.end())
continue;
+ // Coordinate variables (include dummy ones) were read to the file set by default
+ if (std::find(dimNames.begin(), dimNames.end(), vd.varName) != dimNames.end())
+ continue;
+
if (vd.entLoc == ReadNC::ENTLOCSET)
vsetdatas.push_back(vd);
else
@@ -337,7 +414,7 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
if (mit != varInfo.end()) {
ReadNC::VarData vd = (*mit).second;
- // Upon creation of dummy variables, tag values have already been set
+ // Upon creation of dummy coordinate variables, tag values have already been set
if (dummyVarNames.find(vd.varName) != dummyVarNames.end())
continue;
@@ -362,21 +439,21 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
for (unsigned int i = 0; i < vdatas.size(); i++) {
vdatas[i].varTags.resize(tstep_nums.size(), 0);
vdatas[i].varDatas.resize(tstep_nums.size());
+ // NC reader assumes that non-set variables always have timesteps
+ assert(std::find(vdatas[i].varDims.begin(), vdatas[i].varDims.end(), tDim) != vdatas[i].varDims.end());
vdatas[i].has_tsteps = true;
}
for (unsigned int i = 0; i < vsetdatas.size(); i++) {
if ((std::find(vsetdatas[i].varDims.begin(), vsetdatas[i].varDims.end(), tDim) != vsetdatas[i].varDims.end())
- && (vsetdatas[i].varDims.size() > 1)) {
- // Set variables with timesteps: time is the first dimension, followed
- // by other dimensions, e.g. xtime(Time, StrLen)
+ && (vsetdatas[i].varName != dimNames[tDim])) {
+ // Set variables with timesteps: e.g. xtime(Time) or xtime(Time, StrLen)
vsetdatas[i].varTags.resize(tstep_nums.size(), 0);
vsetdatas[i].varDatas.resize(tstep_nums.size());
vsetdatas[i].has_tsteps = true;
}
else {
- // Set variables without timesteps: no time dimension, or time is the only
- // dimension, e.g. lev(lev), xtime(Time)
+ // Set variables without timesteps: no time dimension, or time itself
vsetdatas[i].varTags.resize(1, 0);
vsetdatas[i].varDatas.resize(1);
vsetdatas[i].has_tsteps = false;
@@ -402,7 +479,7 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
void* data = vdatas[i].varDatas[t];
- // Set variables with timesteps, e.g. xtime(Time, StrLen)
+ // Set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
if (vdatas[i].has_tsteps) {
// Set readStart for each timestep along time dimension
vdatas[i].readStarts[0] = tstep_nums[t];
@@ -469,7 +546,7 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
}
vdatas[i].varDatas[t] = NULL;
- // Loop continues only for set variables with timesteps, e.g. xtime(Time, StrLen)
+ // Loop continues only for set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
if (!vdatas[i].has_tsteps)
break;
}
@@ -610,6 +687,10 @@ ErrorCode NCHelper::get_tag_to_set(ReadNC::VarData& var_data, int tstep_num, Tag
{
Interface*& mbImpl = _readNC->mbImpl;
DebugOutput& dbgOut = _readNC->dbgOut;
+ int& tStepBase = _readNC->tStepBase;
+
+ if (tStepBase > 0)
+ tstep_num += tStepBase;
std::ostringstream tag_name;
if (var_data.has_tsteps)
@@ -647,6 +728,10 @@ ErrorCode NCHelper::get_tag_to_nonset(ReadNC::VarData& var_data, int tstep_num,
{
Interface*& mbImpl = _readNC->mbImpl;
DebugOutput& dbgOut = _readNC->dbgOut;
+ int& tStepBase = _readNC->tStepBase;
+
+ if (tStepBase > 0)
+ tstep_num += tStepBase;
std::ostringstream tag_name;
tag_name << var_data.varName << tstep_num;
@@ -749,13 +834,13 @@ ErrorCode NCHelper::create_dummy_variables()
// Hack: look at all dimensions, and see if we have one that does not appear in the list of varInfo names
// Right now, candidates are from unstructured meshes, such as ncol (HOMME) and nCells (MPAS)
- // For each of them, create a dummy variable with a sparse tag to store the dimension length
+ // For each of them, create a dummy coordinate variable with a sparse tag to store the dimension length
for (unsigned int i = 0; i < dimNames.size(); i++) {
// If there is a variable with this dimension name, skip
if (varInfo.find(dimNames[i]) != varInfo.end())
continue;
- // Create a dummy variable
+ // Create a dummy coordinate variable
int sizeTotalVar = varInfo.size();
std::string var_name(dimNames[i]);
ReadNC::VarData& data = varInfo[var_name];
@@ -768,13 +853,13 @@ ErrorCode NCHelper::create_dummy_variables()
data.numAtts = 0;
data.entLoc = ReadNC::ENTLOCSET;
dummyVarNames.insert(dimNames[i]);
- dbgOut.tprintf(2, "Dummy variable created for dimension %s\n", dimNames[i].c_str());
+ dbgOut.tprintf(2, "Dummy coordinate variable created for dimension %s\n", dimNames[i].c_str());
// Create a corresponding sparse tag
Tag tagh;
ErrorCode rval = mbImpl->tag_get_handle(dimNames[i].c_str(), 0, MB_TYPE_INTEGER, tagh,
MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
- ERRORR(rval, "Failed to create tag for a dummy dimension variable.");
+ ERRORR(rval, "Failed to create tag for a dummy coordinate variable.");
// Tag value is the dimension length
const void* ptr = &dimLens[i];
@@ -860,7 +945,7 @@ ErrorCode NCHelper::read_variable_to_set_allocate(std::vector<ReadNC::VarData>&
rval = MB_FAILURE;
}
- // Loop continues only for set variables with timesteps, e.g. xtime(Time, StrLen)
+ // Loop continues only for set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
if (!vdatas[i].has_tsteps)
break;
}
@@ -1005,6 +1090,10 @@ ErrorCode ScdNCHelper::create_mesh(Range& faces)
Range edges;
mbImpl->get_adjacencies(faces, 1, true, edges, Interface::UNION);
+ // Create COORDS tag for quads
+ rval = create_quad_coordinate_tag();
+ ERRORR(rval, "Trouble creating coordinate tags to entities quads");
+
return MB_SUCCESS;
}
@@ -1016,10 +1105,6 @@ ErrorCode ScdNCHelper::read_variables(std::vector<std::string>& var_names, std::
ErrorCode rval = read_variable_setup(var_names, tstep_nums, vdatas, vsetdatas);
ERRORR(rval, "Trouble setting up read variable.");
- // Create COORDS tag for quads
- rval = create_quad_coordinate_tag();
- ERRORR(rval, "Trouble creating coordinate tags to entities quads");
-
if (!vsetdatas.empty()) {
rval = read_variable_to_set(vsetdatas, tstep_nums);
ERRORR(rval, "Trouble read variables to set.");
@@ -1190,7 +1275,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
std::vector<char> tmpchardata(sz);
success = NCFUNCAG(_vara_text)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
&tmpchardata[0]);
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, lat, lon) to (lat, lon, lev)
success = kji_to_jik(ni, nj, nk, data, &tmpchardata[0]);
else {
@@ -1204,7 +1289,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
std::vector<double> tmpdoubledata(sz);
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
&tmpdoubledata[0]);
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, lat, lon) to (lat, lon, lev)
success = kji_to_jik(ni, nj, nk, data, &tmpdoubledata[0]);
else {
@@ -1218,7 +1303,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
std::vector<float> tmpfloatdata(sz);
success = NCFUNCAG(_vara_float)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
&tmpfloatdata[0]);
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, lat, lon) to (lat, lon, lev)
success = kji_to_jik(ni, nj, nk, data, &tmpfloatdata[0]);
else {
@@ -1232,7 +1317,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
std::vector<int> tmpintdata(sz);
success = NCFUNCAG(_vara_int)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
&tmpintdata[0]);
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, lat, lon) to (lat, lon, lev)
success = kji_to_jik(ni, nj, nk, data, &tmpintdata[0]);
else {
@@ -1246,7 +1331,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
std::vector<short> tmpshortdata(sz);
success = NCFUNCAG(_vara_short)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
&tmpshortdata[0]);
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, lat, lon) to (lat, lon, lev)
success = kji_to_jik(ni, nj, nk, data, &tmpshortdata[0]);
else {
@@ -1302,8 +1387,7 @@ ErrorCode ScdNCHelper::create_quad_coordinate_tag() {
ERRORR(rval, "Trouble getting owned QUAD entity.");
numOwnedEnts = ents_owned.size();
}
- else
- {
+ else {
numOwnedEnts = ents.size();
ents_owned = ents;
}
diff --git a/src/io/NCHelper.hpp b/src/io/NCHelper.hpp
index 817257c..d134249 100644
--- a/src/io/NCHelper.hpp
+++ b/src/io/NCHelper.hpp
@@ -35,6 +35,9 @@ public:
//! Create NC conventional tags
ErrorCode create_conventional_tags(const std::vector<int>& tstep_nums);
+ //! Update time tag values if timesteps spread across files
+ ErrorCode update_time_tag_vals();
+
protected:
//! Separate set and non-set variables (common to scd mesh and ucd mesh)
ErrorCode read_variable_setup(std::vector<std::string>& var_names,
diff --git a/src/io/NCHelperEuler.cpp b/src/io/NCHelperEuler.cpp
index b117921..5bf8eec 100644
--- a/src/io/NCHelperEuler.cpp
+++ b/src/io/NCHelperEuler.cpp
@@ -324,14 +324,14 @@ ErrorCode NCHelperEuler::init_mesh_vals()
for (mit = varInfo.begin(); mit != varInfo.end(); ++mit) {
ReadNC::VarData& vd = (*mit).second;
- vd.entLoc = ReadNC::ENTLOCSET;
+ // Default entLoc is ENTLOCSET
if (std::find(vd.varDims.begin(), vd.varDims.end(), tDim) != vd.varDims.end()) {
if ((std::find(vd.varDims.begin(), vd.varDims.end(), iCDim) != vd.varDims.end()) &&
(std::find(vd.varDims.begin(), vd.varDims.end(), jCDim) != vd.varDims.end()))
vd.entLoc = ReadNC::ENTLOCFACE;
}
- vd.numLev = 1;
+ // Default numLev is 0
if (std::find(vd.varDims.begin(), vd.varDims.end(), levDim) != vd.varDims.end())
vd.numLev = nLevels;
}
diff --git a/src/io/NCHelperFV.cpp b/src/io/NCHelperFV.cpp
index 7725b55..affd0ef 100644
--- a/src/io/NCHelperFV.cpp
+++ b/src/io/NCHelperFV.cpp
@@ -320,7 +320,7 @@ ErrorCode NCHelperFV::init_mesh_vals()
for (mit = varInfo.begin(); mit != varInfo.end(); ++mit) {
ReadNC::VarData& vd = (*mit).second;
- vd.entLoc = ReadNC::ENTLOCSET;
+ // Default entLoc is ENTLOCSET
if (std::find(vd.varDims.begin(), vd.varDims.end(), tDim) != vd.varDims.end()) {
if ((std::find(vd.varDims.begin(), vd.varDims.end(), iCDim) != vd.varDims.end()) &&
(std::find(vd.varDims.begin(), vd.varDims.end(), jCDim) != vd.varDims.end()))
@@ -333,7 +333,7 @@ ErrorCode NCHelperFV::init_mesh_vals()
vd.entLoc = ReadNC::ENTLOCEWEDGE;
}
- vd.numLev = 1;
+ // Default numLev is 0
if (std::find(vd.varDims.begin(), vd.varDims.end(), levDim) != vd.varDims.end())
vd.numLev = nLevels;
}
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/fathomteam/moab/commits/69b506e8be12/
Changeset: 69b506e8be12
Branch: None
User: makeclean
Date: 2014-06-06 17:49:13
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 10 files
diff --git a/MeshFiles/unittest/io/gcrm_r3.nc b/MeshFiles/unittest/io/gcrm_r3.nc
index 6d1b8d2..1c7328b 100644
Binary files a/MeshFiles/unittest/io/gcrm_r3.nc and b/MeshFiles/unittest/io/gcrm_r3.nc differ
diff --git a/src/io/NCHelperGCRM.cpp b/src/io/NCHelperGCRM.cpp
index f61cca5..6870808 100644
--- a/src/io/NCHelperGCRM.cpp
+++ b/src/io/NCHelperGCRM.cpp
@@ -18,12 +18,11 @@
namespace moab {
-const int DEFAULT_MAX_EDGES_PER_CELL = 6;
+// GCRM cells are either pentagons or hexagons, and pentagons are always padded to hexagons
+const int EDGES_PER_CELL = 6;
NCHelperGCRM::NCHelperGCRM(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
: UcdNCHelper(readNC, fileId, opts, fileSet)
-, maxEdgesPerCell(DEFAULT_MAX_EDGES_PER_CELL)
-, numCellGroups(0)
, createGatherSet(false)
{
// Ignore variables containing topological information
@@ -38,7 +37,7 @@ bool NCHelperGCRM::can_read_file(ReadNC* readNC)
{
std::vector<std::string>& dimNames = readNC->dimNames;
- // If dimension name "vertexDegree" exists then it should be the GCRM grid
+ // If dimension name "cells" exists then it should be the GCRM grid
if (std::find(dimNames.begin(), dimNames.end(), std::string("cells")) != dimNames.end())
return true;
@@ -103,10 +102,10 @@ ErrorCode NCHelperGCRM::init_mesh_vals()
levDim = idx;
nLevels = dimLens[idx];
- // Dimension numbers for other optional levels
+ // Dimension indices for other optional levels
std::vector<unsigned int> opt_lev_dims;
- // Get number of interface levels
+ // Get index of interface levels
if ((vit = std::find(dimNames.begin(), dimNames.end(), "interfaces")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
@@ -179,14 +178,6 @@ ErrorCode NCHelperGCRM::check_existing_mesh()
if (noMesh) {
ErrorCode rval;
- // Restore numCellGroups
- if (0 == numCellGroups) {
- Tag numCellGroupsTag;
- rval = mbImpl->tag_get_handle("__NUM_CELL_GROUPS", 1, MB_TYPE_INTEGER, numCellGroupsTag);
- if (MB_SUCCESS == rval)
- rval = mbImpl->tag_get_data(numCellGroupsTag, &_fileSet, 1, &numCellGroups);
- }
-
if (localGidVerts.empty()) {
// Get all vertices from tmp_set (it is the input set in no_mesh scenario)
Range local_verts;
@@ -247,14 +238,6 @@ ErrorCode NCHelperGCRM::check_existing_mesh()
// Restore localGidCells
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidCells));
nLocalCells = localGidCells.size();
-
- if (numCellGroups > 1) {
- // Restore cellHandleToGlobalID map
- Range::const_iterator rit;
- int i;
- for (rit = local_cells.begin(), i = 0; rit != local_cells.end(); ++rit, i++)
- cellHandleToGlobalID[*rit] = gids[i];
- }
}
}
}
@@ -264,9 +247,7 @@ ErrorCode NCHelperGCRM::check_existing_mesh()
ErrorCode NCHelperGCRM::create_mesh(Range& faces)
{
- Interface*& mbImpl = _readNC->mbImpl;
int& gatherSetRank = _readNC->gatherSetRank;
- bool& noMixedElements = _readNC->noMixedElements;
bool& noEdges = _readNC->noEdges;
DebugOutput& dbgOut = _readNC->dbgOut;
@@ -317,9 +298,8 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
int verticesOnCellVarId;
int success = NCFUNC(inq_varid)(_fileId, "cell_corners", &verticesOnCellVarId);
ERRORS(success, "Failed to get variable id of cell_corners.");
- std::vector<int> vertices_on_local_cells(nLocalCells * maxEdgesPerCell);
+ std::vector<int> vertices_on_local_cells(nLocalCells * EDGES_PER_CELL);
dbgOut.tprintf(1, " nLocalCells = %d\n", (int)nLocalCells);
- dbgOut.tprintf(1, " maxEdgesPerCell = %d\n", (int)maxEdgesPerCell);
dbgOut.tprintf(1, " vertices_on_local_cells.size() = %d\n", (int)vertices_on_local_cells.size());
#ifdef PNETCDF_FILE
size_t nb_reads = localGidCells.psize();
@@ -337,7 +317,7 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
dbgOut.tprintf(1, " cell_corners endh = %d\n", (int)endh);
NCDF_SIZE read_starts[2] = {static_cast<NCDF_SIZE>(starth - 1), 0};
NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1),
- static_cast<NCDF_SIZE>(maxEdgesPerCell)};
+ static_cast<NCDF_SIZE>(EDGES_PER_CELL)};
// Do a partial read in each subrange
#ifdef PNETCDF_FILE
@@ -350,7 +330,7 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
ERRORS(success, "Failed to read cell_corners data in a loop");
// Increment the index for next subrange
- indexInArray += (endh - starth + 1) * maxEdgesPerCell;
+ indexInArray += (endh - starth + 1) * EDGES_PER_CELL;
}
#ifdef PNETCDF_FILE
@@ -360,8 +340,22 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
#endif
// GCRM is 0 based, convert vertex indices from 0 to 1 based
- for (std::size_t idx = 0; idx < vertices_on_local_cells.size(); idx++) {
+ for (std::size_t idx = 0; idx < vertices_on_local_cells.size(); idx++)
vertices_on_local_cells[idx] += 1;
+
+ // Correct vertices_on_local_cells array. Pentagons as hexagons should have
+ // a connectivity like 123455 and not 122345
+ for (int local_cell_idx = 0; local_cell_idx < nLocalCells; local_cell_idx++) {
+ int* pvertex = &vertices_on_local_cells[local_cell_idx * EDGES_PER_CELL];
+ for (int k = 0; k < EDGES_PER_CELL - 2; k++) {
+ if (*(pvertex + k) == *(pvertex + k + 1)) {
+ // Shift the connectivity
+ for (int kk = k + 1; kk < EDGES_PER_CELL - 1; kk++)
+ *(pvertex + kk) = *(pvertex + kk + 1);
+ // No need to try next k
+ break;
+ }
+ }
}
// Create local vertices
@@ -375,24 +369,12 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
ERRORR(rval, "Failed to create local edges for GCRM mesh.");
}
- // Create local cells, either unpadded or padded
- if (noMixedElements) {
- rval = create_padded_local_cells(vertices_on_local_cells, start_vertex, faces);
- ERRORR(rval, "Failed to create padded local cells for GCRM mesh.");
- }
- else {
- rval = create_local_cells(vertices_on_local_cells, start_vertex, faces);
- ERRORR(rval, "Failed to create local cells for GCRM mesh.");
- }
-
- // Set tag for numCellGroups
- Tag numCellGroupsTag = 0;
- rval = mbImpl->tag_get_handle("__NUM_CELL_GROUPS", 1, MB_TYPE_INTEGER, numCellGroupsTag, MB_TAG_SPARSE | MB_TAG_CREAT);
- ERRORR(rval, "Failed to get __NUM_CELL_GROUPS tag.");
- rval = mbImpl->tag_set_data(numCellGroupsTag, &_fileSet, 1, &numCellGroups);
- ERRORR(rval, "Failed to set data for __NUM_CELL_GROUPS tag.");
+ // Create local cells with padding
+ rval = create_padded_local_cells(vertices_on_local_cells, start_vertex, faces);
+ ERRORR(rval, "Failed to create local cells for GCRM mesh.");
if (createGatherSet) {
+#if 0
EntityHandle gather_set;
rval = _readNC->readMeshIface->create_gather_set(gather_set);
ERRORR(rval, "Failed to create gather set.");
@@ -408,15 +390,10 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
ERRORR(rval, "Failed to create gather set edges for GCRM mesh.");
}
- // Create gather set cells, either unpadded or padded
- if (noMixedElements) {
- rval = create_padded_gather_set_cells(gather_set, start_gather_set_vertex);
- ERRORR(rval, "Failed to create padded gather set cells for GCRM mesh.");
- }
- else {
- rval = create_gather_set_cells(gather_set, start_gather_set_vertex);
- ERRORR(rval, "Failed to create gather set cells for GCRM mesh.");
- }
+ // Create gather set cells with padding
+ rval = create_padded_gather_set_cells(gather_set, start_gather_set_vertex);
+ ERRORR(rval, "Failed to create gather set cells for GCRM mesh.");
+#endif
}
return MB_SUCCESS;
@@ -541,19 +518,13 @@ ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset_allocate(std::vector<ReadNC:
}
// Get ptr to tag space
- if (vdatas[i].entLoc == ReadNC::ENTLOCFACE && numCellGroups > 1) {
- // For a cell variable that is NOT on one contiguous chunk of faces, defer its tag space allocation
- vdatas[i].varDatas[t] = NULL;
- }
- else {
- assert(1 == range->psize());
- void* data;
- int count;
- rval = mbImpl->tag_iterate(vdatas[i].varTags[t], range->begin(), range->end(), count, data);
- ERRORR(rval, "Failed to iterate tag.");
- assert((unsigned)count == range->size());
- vdatas[i].varDatas[t] = data;
- }
+ assert(1 == range->psize());
+ void* data;
+ int count;
+ rval = mbImpl->tag_iterate(vdatas[i].varTags[t], range->begin(), range->end(), count, data);
+ ERRORR(rval, "Failed to iterate tag.");
+ assert((unsigned)count == range->size());
+ vdatas[i].varDatas[t] = data;
}
}
@@ -563,7 +534,6 @@ ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset_allocate(std::vector<ReadNC:
#ifdef PNETCDF_FILE
ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
{
- Interface*& mbImpl = _readNC->mbImpl;
bool& noEdges = _readNC->noEdges;
DebugOutput& dbgOut = _readNC->dbgOut;
@@ -647,32 +617,9 @@ ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset_async(std::vector<ReadNC::Va
success = NCFUNC(wait_all)(_fileId, requests.size(), &requests[0], &statuss[0]);
ERRORS(success, "Failed on wait_all.");
- if (vdatas[i].entLoc == ReadNC::ENTLOCFACE && numCellGroups > 1) {
- // For a cell variable that is NOT on one contiguous chunk of faces, allocate tag space for
- // each cell group, and utilize cellHandleToGlobalID map to read tag data
- Range::iterator iter = facesOwned.begin();
- while (iter != facesOwned.end()) {
- int count;
- void* ptr;
- rval = mbImpl->tag_iterate(vdatas[i].varTags[t], iter, facesOwned.end(), count, ptr);
- ERRORR(rval, "Failed to iterate tag on owned faces.");
-
- for (int j = 0; j < count; j++) {
- int global_cell_idx = cellHandleToGlobalID[*(iter + j)]; // Global cell index, 1 based
- int local_cell_idx = localGidCells.index(global_cell_idx); // Local cell index, 0 based
- assert(local_cell_idx != -1);
- for (int level = 0; level < vdatas[i].numLev; level++)
- ((double*) ptr)[j * vdatas[i].numLev + level] = tmpdoubledata[local_cell_idx * vdatas[i].numLev + level];
- }
-
- iter += count;
- }
- }
- else {
- void* data = vdatas[i].varDatas[t];
- for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
- ((double*) data)[idx] = tmpdoubledata[idx];
- }
+ void* data = vdatas[i].varDatas[t];
+ for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
+ ((double*) data)[idx] = tmpdoubledata[idx];
break;
}
@@ -694,17 +641,6 @@ ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset_async(std::vector<ReadNC::Va
}
}
- for (unsigned int i = 0; i < vdatas.size(); i++) {
- if (noEdges && vdatas[i].entLoc == ReadNC::ENTLOCEDGE)
- continue;
-
- /*for (unsigned int t = 0; t < tstep_nums.size(); t++) {
- dbgOut.tprintf(2, "Converting variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
- ErrorCode tmp_rval = convert_variable(vdatas[i], t);
- if (MB_SUCCESS != tmp_rval)
- rval = tmp_rval;
- }*/
- }
// Debug output, if requested
if (1 == dbgOut.get_verbosity()) {
dbgOut.printf(1, "Read variables: %s", vdatas.begin()->varName.c_str());
@@ -790,32 +726,9 @@ ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>
}
assert(ic == pLocalGid->psize());
- if (vdatas[i].entLoc == ReadNC::ENTLOCFACE && numCellGroups > 1) {
- // For a cell variable that is NOT on one contiguous chunk of faces, allocate tag space for
- // each cell group, and utilize cellHandleToGlobalID map to read tag data
- Range::iterator iter = facesOwned.begin();
- while (iter != facesOwned.end()) {
- int count;
- void* ptr;
- rval = mbImpl->tag_iterate(vdatas[i].varTags[t], iter, facesOwned.end(), count, ptr);
- ERRORR(rval, "Failed to iterate tag on owned faces.");
-
- for (int j = 0; j < count; j++) {
- int global_cell_idx = cellHandleToGlobalID[*(iter + j)]; // Global cell index, 1 based
- int local_cell_idx = localGidCells.index(global_cell_idx); // Local cell index, 0 based
- assert(local_cell_idx != -1);
- for (int level = 0; level < vdatas[i].numLev; level++)
- ((double*) ptr)[j * vdatas[i].numLev + level] = tmpdoubledata[local_cell_idx * vdatas[i].numLev + level];
- }
-
- iter += count;
- }
- }
- else {
- void* data = vdatas[i].varDatas[t];
- for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
- ((double*) data)[idx] = tmpdoubledata[idx];
- }
+ void* data = vdatas[i].varDatas[t];
+ for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
+ ((double*) data)[idx] = tmpdoubledata[idx];
break;
}
@@ -836,18 +749,6 @@ ErrorCode NCHelperGCRM::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>
}
}
- for (unsigned int i = 0; i < vdatas.size(); i++) {
- if (noEdges && vdatas[i].entLoc == ReadNC::ENTLOCEDGE)
- continue;
-
- /* for (unsigned int t = 0; t < tstep_nums.size(); t++) {
- dbgOut.tprintf(2, "Converting variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
- ErrorCode tmp_rval = convert_variable(vdatas[i], t);
- if (MB_SUCCESS != tmp_rval)
- rval = tmp_rval;
- }*/
- }
-
// Debug output, if requested
if (1 == dbgOut.get_verbosity()) {
dbgOut.printf(1, "Read variables: %s", vdatas.begin()->varName.c_str());
@@ -991,20 +892,18 @@ ErrorCode NCHelperGCRM::create_local_vertices(const std::vector<int>& vertices_o
ERRORR(MB_FAILURE, "Couldn't find 'layers' or 'interfaces' variable.");
}
- {
- // Decide whether down is positive
- char posval[10] = {0};
- int success = NCFUNC(get_att_text)(_fileId, (*vmit).second.varId, "positive", posval);
- if (0 == success && !strncmp(posval, "down", 4)) {
- for (std::vector<double>::iterator dvit = levVals.begin(); dvit != levVals.end(); ++dvit)
- (*dvit) *= -1.0;
- }
+ // Decide whether down is positive
+ char posval[10] = {0};
+ int success = NCFUNC(get_att_text)(_fileId, (*vmit).second.varId, "positive", posval);
+ if (0 == success && !strncmp(posval, "down", 4)) {
+ for (std::vector<double>::iterator dvit = levVals.begin(); dvit != levVals.end(); ++dvit)
+ (*dvit) *= -1.0;
}
// Read x coordinates for local vertices
double* xptr = arrays[0];
int xVertexVarId;
- int success = NCFUNC(inq_varid)(_fileId, "grid_corner_lon", &xVertexVarId);
+ success = NCFUNC(inq_varid)(_fileId, "grid_corner_lon", &xVertexVarId);
ERRORS(success, "Failed to get variable id of grid_corner_lon.");
size_t indexInArray = 0;
for (Range::pair_iterator pair_iter = localGidVerts.pair_begin();
@@ -1100,7 +999,7 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
int success = NCFUNC(inq_varid)(_fileId, "cell_edges", &edgesOnCellVarId);
ERRORS(success, "Failed to get variable id of cell_edges.");
- std::vector<int> edges_on_local_cells(nLocalCells * maxEdgesPerCell);
+ std::vector<int> edges_on_local_cells(nLocalCells * EDGES_PER_CELL);
dbgOut.tprintf(1, " edges_on_local_cells.size() = %d\n", (int)edges_on_local_cells.size());
#ifdef PNETCDF_FILE
@@ -1118,7 +1017,7 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
dbgOut.tprintf(1, " starth = %d\n", (int)starth);
dbgOut.tprintf(1, " endh = %d\n", (int)endh);
NCDF_SIZE read_starts[2] = {static_cast<NCDF_SIZE>(starth - 1), 0};
- NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1), static_cast<NCDF_SIZE>(maxEdgesPerCell)};
+ NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1), static_cast<NCDF_SIZE>(EDGES_PER_CELL)};
// Do a partial read in each subrange
#ifdef PNETCDF_FILE
@@ -1131,7 +1030,7 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
ERRORS(success, "Failed to read cell_edges data in a loop");
// Increment the index for next subrange
- indexInArray += (endh - starth + 1) * maxEdgesPerCell;
+ indexInArray += (endh - starth + 1) * EDGES_PER_CELL;
}
#ifdef PNETCDF_FILE
@@ -1141,9 +1040,8 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
#endif
// GCRM is 0 based, convert edge indices from 0 to 1 based
- for (std::size_t idx = 0; idx < edges_on_local_cells.size(); idx++) {
+ for (std::size_t idx = 0; idx < edges_on_local_cells.size(); idx++)
edges_on_local_cells[idx] += 1;
- }
// Collect local edges
std::sort(edges_on_local_cells.begin(), edges_on_local_cells.end());
@@ -1218,9 +1116,8 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
#endif
// GCRM is 0 based, convert edge indices from 0 to 1 based
- for (int idx = 0; idx < nLocalEdges*2; idx++) {
+ for (int idx = 0; idx < nLocalEdges*2; idx++)
vertices_on_local_edges[idx] += 1;
- }
// Populate connectivity data for local edges
// Convert in-place from int (stored in the first half) to EntityHandle
@@ -1235,104 +1132,16 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
return MB_SUCCESS;
}
-ErrorCode NCHelperGCRM::create_local_cells(const std::vector<int>& vertices_on_local_cells,
- EntityHandle start_vertex, Range& faces)
-{
- Interface*& mbImpl = _readNC->mbImpl;
- Tag& mGlobalIdTag = _readNC->mGlobalIdTag;
-
- // Divide local cells into groups based on the number of edges
- Range local_cells_with_n_edges[DEFAULT_MAX_EDGES_PER_CELL + 1];
- // Insert larger values before smaller ones to increase efficiency
- for (int i = nLocalCells - 1; i >= 0; i--) {
- int num_edges = DEFAULT_MAX_EDGES_PER_CELL;
- local_cells_with_n_edges[num_edges].insert(localGidCells[i]); // Global cell index
- }
-
- std::vector<int> num_edges_on_cell_groups;
- for (int i = 3; i <= maxEdgesPerCell; i++) {
- if (local_cells_with_n_edges[i].size() > 0)
- num_edges_on_cell_groups.push_back(i);
- }
- numCellGroups = num_edges_on_cell_groups.size();
-
- EntityHandle* conn_arr_local_cells_with_n_edges[DEFAULT_MAX_EDGES_PER_CELL + 1];
- for (int i = 0; i < numCellGroups; i++) {
- int num_edges_per_cell = num_edges_on_cell_groups[i];
- int num_group_cells = (int)local_cells_with_n_edges[num_edges_per_cell].size();
-
- // Create local cells for each non-empty cell group
- EntityHandle start_element;
- ErrorCode rval = _readNC->readMeshIface->get_element_connect(num_group_cells, num_edges_per_cell, MBPOLYGON, 0, start_element,
- conn_arr_local_cells_with_n_edges[num_edges_per_cell], num_group_cells);
- ERRORR(rval, "Failed to create cells");
- faces.insert(start_element, start_element + num_group_cells - 1);
-
- // Add local cells to the file set
- Range local_cells_range(start_element, start_element + num_group_cells - 1);
- rval = _readNC->mbImpl->add_entities(_fileSet, local_cells_range);
- ERRORR(rval, "Failed to add local cells to the file set.");
-
- // Get ptr to gid memory for local cells
- int count = 0;
- void* data = NULL;
- rval = mbImpl->tag_iterate(mGlobalIdTag, local_cells_range.begin(), local_cells_range.end(), count, data);
- ERRORR(rval, "Failed to iterate global id tag on local cells.");
- assert(count == num_group_cells);
- int* gid_data = (int*) data;
- std::copy(local_cells_with_n_edges[num_edges_per_cell].begin(), local_cells_with_n_edges[num_edges_per_cell].end(), gid_data);
-
- // Set connectivity array with proper local vertices handles
- for (int j = 0; j < num_group_cells; j++) {
- EntityHandle global_cell_idx = local_cells_with_n_edges[num_edges_per_cell][j]; // Global cell index, 1 based
- int local_cell_idx = localGidCells.index(global_cell_idx); // Local cell index, 0 based
- assert(local_cell_idx != -1);
-
- if (numCellGroups > 1) {
- // Populate cellHandleToGlobalID map to read cell variables
- cellHandleToGlobalID[start_element + j] = global_cell_idx;
- }
-
- for (int k = 0; k < num_edges_per_cell; k++) {
- EntityHandle global_vert_idx = vertices_on_local_cells[local_cell_idx * maxEdgesPerCell + k]; // Global vertex index, 1 based
- int local_vert_idx = localGidVerts.index(global_vert_idx); // Local vertex index, 0 based
- assert(local_vert_idx != -1);
- conn_arr_local_cells_with_n_edges[num_edges_per_cell][j * num_edges_per_cell + k] =
- start_vertex + local_vert_idx;
- }
- // make sure that if some nodes are repeated, they are at the end of the connectivity array
- // so, pentagons as hexagons should have a connectivity like 123455 and not 122345
- EntityHandle *pvertex= &(conn_arr_local_cells_with_n_edges[num_edges_per_cell][j * num_edges_per_cell ]);
- for (int k = 0; k < num_edges_per_cell-2; k++)
- {
- if( *(pvertex+k) == *(pvertex+k+1) )
- {
- // shift the connectivity
- for (int kk=k+1; kk<num_edges_per_cell-2; kk++)
- {
- *(pvertex+kk)=*(pvertex+kk+1);
- }
- }
- }
- }
- }
-
- return MB_SUCCESS;
-}
-
ErrorCode NCHelperGCRM::create_padded_local_cells(const std::vector<int>& vertices_on_local_cells,
- EntityHandle start_vertex, Range& faces)
+ EntityHandle start_vertex, Range& faces)
{
Interface*& mbImpl = _readNC->mbImpl;
Tag& mGlobalIdTag = _readNC->mGlobalIdTag;
- // Only one group of cells (each cell is represented by a polygon with maxEdgesPerCell edges)
- numCellGroups = 1;
-
- // Create cells for this cell group
+ // Create cells
EntityHandle start_element;
EntityHandle* conn_arr_local_cells = NULL;
- ErrorCode rval = _readNC->readMeshIface->get_element_connect(nLocalCells, maxEdgesPerCell, MBPOLYGON, 0, start_element, conn_arr_local_cells,
+ ErrorCode rval = _readNC->readMeshIface->get_element_connect(nLocalCells, EDGES_PER_CELL, MBPOLYGON, 0, start_element, conn_arr_local_cells,
// Might have to create gather mesh later
(createGatherSet ? nLocalCells + nCells : nLocalCells));
ERRORR(rval, "Failed to create cells.");
@@ -1353,20 +1162,21 @@ ErrorCode NCHelperGCRM::create_padded_local_cells(const std::vector<int>& vertic
std::copy(localGidCells.begin(), localGidCells.end(), gid_data);
// Set connectivity array with proper local vertices handles
- // vertices_on_local_cells array was already corrected to have the last vertices padded
- // no need for extra checks considering
+ // vertices_on_local_cells array was already corrected to have
+ // the last vertices repeated for pentagons, e.g. 122345 => 123455
for (int local_cell_idx = 0; local_cell_idx < nLocalCells; local_cell_idx++) {
- for (int i = 0; i < maxEdgesPerCell; i++) {
- EntityHandle global_vert_idx = vertices_on_local_cells[local_cell_idx * maxEdgesPerCell + i]; // Global vertex index, 1 based
+ for (int i = 0; i < EDGES_PER_CELL; i++) {
+ EntityHandle global_vert_idx = vertices_on_local_cells[local_cell_idx * EDGES_PER_CELL + i]; // Global vertex index, 1 based
int local_vert_idx = localGidVerts.index(global_vert_idx); // Local vertex index, 0 based
assert(local_vert_idx != -1);
- conn_arr_local_cells[local_cell_idx * maxEdgesPerCell + i] = start_vertex + local_vert_idx;
+ conn_arr_local_cells[local_cell_idx * EDGES_PER_CELL + i] = start_vertex + local_vert_idx;
}
}
return MB_SUCCESS;
}
+#if 0
ErrorCode NCHelperGCRM::create_gather_set_vertices(EntityHandle gather_set, EntityHandle& gather_set_start_vertex)
{
Interface*& mbImpl = _readNC->mbImpl;
@@ -1513,92 +1323,6 @@ ErrorCode NCHelperGCRM::create_gather_set_edges(EntityHandle gather_set, EntityH
return MB_SUCCESS;
}
-ErrorCode NCHelperGCRM::create_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex)
-{
- Interface*& mbImpl = _readNC->mbImpl;
-
- // Read number of edges on each gather set cell
- int nEdgesOnCellVarId;
- int success = NCFUNC(inq_varid)(_fileId, "nEdgesOnCell", &nEdgesOnCellVarId);
- ERRORS(success, "Failed to get variable id of nEdgesOnCell.");
- std::vector<int> num_edges_on_gather_set_cells(nCells);
- NCDF_SIZE read_start = 0;
- NCDF_SIZE read_count = static_cast<NCDF_SIZE>(nCells);
-#ifdef PNETCDF_FILE
- // Enter independent I/O mode, since this read is only for the gather processor
- success = NCFUNC(begin_indep_data)(_fileId);
- ERRORS(success, "Failed to begin independent I/O mode.");
- success = NCFUNCG(_vara_int)(_fileId, nEdgesOnCellVarId, &read_start, &read_count, &num_edges_on_gather_set_cells[0]);
- ERRORS(success, "Failed to read nEdgesOnCell data.");
- success = NCFUNC(end_indep_data)(_fileId);
- ERRORS(success, "Failed to end independent I/O mode.");
-#else
- success = NCFUNCG(_vara_int)(_fileId, nEdgesOnCellVarId, &read_start, &read_count, &num_edges_on_gather_set_cells[0]);
- ERRORS(success, "Failed to read nEdgesOnCell data.");
-#endif
-
- // Read vertices on each gather set cell (connectivity)
- int verticesOnCellVarId;
- success = NCFUNC(inq_varid)(_fileId, "verticesOnCell", &verticesOnCellVarId);
- ERRORS(success, "Failed to get variable id of verticesOnCell.");
- std::vector<int> vertices_on_gather_set_cells(nCells * maxEdgesPerCell);
- NCDF_SIZE read_starts[2] = {0, 0};
- NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(nCells), static_cast<NCDF_SIZE>(maxEdgesPerCell)};
-#ifdef PNETCDF_FILE
- // Enter independent I/O mode, since this read is only for the gather processor
- success = NCFUNC(begin_indep_data)(_fileId);
- ERRORS(success, "Failed to begin independent I/O mode.");
- success = NCFUNCG(_vara_int)(_fileId, verticesOnCellVarId, read_starts, read_counts, &vertices_on_gather_set_cells[0]);
- ERRORS(success, "Failed to read verticesOnCell data.");
- success = NCFUNC(end_indep_data)(_fileId);
- ERRORS(success, "Failed to end independent I/O mode.");
-#else
- success = NCFUNCG(_vara_int)(_fileId, verticesOnCellVarId, read_starts, read_counts, &vertices_on_gather_set_cells[0]);
- ERRORS(success, "Failed to read verticesOnCell data.");
-#endif
-
- // Divide gather set cells into groups based on the number of edges
- Range gather_set_cells_with_n_edges[DEFAULT_MAX_EDGES_PER_CELL + 1];
- // Insert larger values before smaller values to increase efficiency
- for (int i = nCells - 1; i >= 0; i--) {
- int num_edges = num_edges_on_gather_set_cells[i];
- gather_set_cells_with_n_edges[num_edges].insert(i + 1); // 0 based -> 1 based
- }
-
- // Create gather set cells
- EntityHandle* conn_arr_gather_set_cells_with_n_edges[DEFAULT_MAX_EDGES_PER_CELL + 1];
- for (int num_edges_per_cell = 3; num_edges_per_cell <= maxEdgesPerCell; num_edges_per_cell++) {
- int num_group_cells = gather_set_cells_with_n_edges[num_edges_per_cell].size();
- if (num_group_cells > 0) {
- EntityHandle start_element;
- ErrorCode rval = _readNC->readMeshIface->get_element_connect(num_group_cells, num_edges_per_cell, MBPOLYGON, 0, start_element,
- conn_arr_gather_set_cells_with_n_edges[num_edges_per_cell], num_group_cells);
- ERRORR(rval, "Failed to create cells.");
-
- // Add cells to the gather set
- Range gather_set_cells_range(start_element, start_element + num_group_cells - 1);
- rval = mbImpl->add_entities(gather_set, gather_set_cells_range);
- ERRORR(rval, "Failed to add cells to the gather set.");
-
- for (int j = 0; j < num_group_cells; j++) {
- int gather_set_cell_idx = gather_set_cells_with_n_edges[num_edges_per_cell][j]; // Global cell index, 1 based
- gather_set_cell_idx--; // 1 based -> 0 based
-
- for (int k = 0; k < num_edges_per_cell; k++) {
- EntityHandle gather_set_vert_idx = vertices_on_gather_set_cells[gather_set_cell_idx * maxEdgesPerCell + k]; // Global vertex index, 1 based
- gather_set_vert_idx--; // 1 based -> 0 based
-
- // Connectivity array is shifted by where the gather set vertices start
- conn_arr_gather_set_cells_with_n_edges[num_edges_per_cell][j * num_edges_per_cell + k] =
- gather_set_start_vertex + gather_set_vert_idx;
- }
- }
- }
- }
-
- return MB_SUCCESS;
-}
-
ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex)
{
Interface*& mbImpl = _readNC->mbImpl;
@@ -1627,7 +1351,7 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
EntityHandle start_element;
EntityHandle* conn_arr_gather_set_cells = NULL;
// Don't need to specify allocation number here, because we know enough cells were created before
- ErrorCode rval = _readNC->readMeshIface->get_element_connect(nCells, maxEdgesPerCell, MBPOLYGON, 0, start_element, conn_arr_gather_set_cells);
+ ErrorCode rval = _readNC->readMeshIface->get_element_connect(nCells, EDGES_PER_CELL, MBPOLYGON, 0, start_element, conn_arr_gather_set_cells);
ERRORR(rval, "Failed to create cells.");
// Add cells to the gather set
@@ -1642,7 +1366,7 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
// Utilize the memory storage pointed by conn_arr_gather_set_cells
int* vertices_on_gather_set_cells = (int*) conn_arr_gather_set_cells;
NCDF_SIZE read_starts[2] = {0, 0};
- NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(nCells), static_cast<NCDF_SIZE>(maxEdgesPerCell)};
+ NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(nCells), static_cast<NCDF_SIZE>(EDGES_PER_CELL)};
#ifdef PNETCDF_FILE
// Enter independent I/O mode, since this read is only for the gather processor
success = NCFUNC(begin_indep_data)(_fileId);
@@ -1660,16 +1384,16 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
// replace the padded vertices with the last vertices in the corresponding cells
for (int gather_set_cell_idx = 0; gather_set_cell_idx < nCells; gather_set_cell_idx++) {
int num_edges = num_edges_on_gather_set_cells[gather_set_cell_idx];
- int idx_in_gather_set_vert_arr = gather_set_cell_idx * maxEdgesPerCell;
+ int idx_in_gather_set_vert_arr = gather_set_cell_idx * EDGES_PER_CELL;
int last_vert_idx = vertices_on_gather_set_cells[idx_in_gather_set_vert_arr + num_edges - 1];
- for (int i = num_edges; i < maxEdgesPerCell; i++)
+ for (int i = num_edges; i < EDGES_PER_CELL; i++)
vertices_on_gather_set_cells[idx_in_gather_set_vert_arr + i] = last_vert_idx;
}
// Populate connectivity data for gather set cells
// Convert in-place from int (stored in the first half) to EntityHandle
// Reading backward is the trick
- for (int cell_vert = nCells * maxEdgesPerCell - 1; cell_vert >= 0; cell_vert--) {
+ for (int cell_vert = nCells * EDGES_PER_CELL - 1; cell_vert >= 0; cell_vert--) {
int gather_set_vert_idx = vertices_on_gather_set_cells[cell_vert]; // Global vertex index, 1 based
gather_set_vert_idx--; // 1 based -> 0 based
// Connectivity array is shifted by where the gather set vertices start
@@ -1678,5 +1402,6 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
return MB_SUCCESS;
}
+#endif
} // namespace moab
diff --git a/src/io/NCHelperGCRM.hpp b/src/io/NCHelperGCRM.hpp
index 3c445f3..1e5f55b 100644
--- a/src/io/NCHelperGCRM.hpp
+++ b/src/io/NCHelperGCRM.hpp
@@ -52,31 +52,23 @@ private:
//! Create local edges (optional)
ErrorCode create_local_edges(EntityHandle start_vertex);
- //! Create local cells without padding (cells are divided into groups based on the number of edges)
- ErrorCode create_local_cells(const std::vector<int>& vertices_on_local_cells,
- EntityHandle start_vertex, Range& faces);
-
- //! Create local cells with padding (padded cells will have the same number of edges)
+ //! Create local cells with padding (pentagons are padded to hexagons)
ErrorCode create_padded_local_cells(const std::vector<int>& vertices_on_local_cells,
EntityHandle start_vertex, Range& faces);
+#if 0
//! Create gather set vertices
ErrorCode create_gather_set_vertices(EntityHandle gather_set, EntityHandle& gather_set_start_vertex);
//! Create gather set edges (optional)
ErrorCode create_gather_set_edges(EntityHandle gather_set, EntityHandle gather_set_start_vertex);
- //! Create gather set cells without padding (cells are divided into groups based on the number of edges)
- ErrorCode create_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex);
-
- //! Create gather set cells with padding (padded cells will have the same number of edges)
+ //! Create gather set cells with padding (pentagons are padded to hexagons)
ErrorCode create_padded_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex);
+#endif
private:
- int maxEdgesPerCell;
- int numCellGroups;
bool createGatherSet;
- std::map<EntityHandle, int> cellHandleToGlobalID;
Range facesOwned;
};
diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index 5c964b9..a02e4ce 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -122,22 +122,22 @@ ErrorCode NCHelperMPAS::init_mesh_vals()
levDim = idx;
nLevels = dimLens[idx];
- // Dimension numbers for other optional levels
+ // Dimension indices for other optional levels
std::vector<unsigned int> opt_lev_dims;
- // Get number of vertex levels P1
+ // Get index of vertex levels P1
if ((vit = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP1")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
}
- // Get number of vertex levels P2
+ // Get index of vertex levels P2
if ((vit = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP2")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
}
- // Get number of soil levels
+ // Get index of soil levels
if ((vit = std::find(dimNames.begin(), dimNames.end(), "nSoilLevels")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
diff --git a/src/io/NCWriteGCRM.cpp b/src/io/NCWriteGCRM.cpp
index 1f9bb97..b80d90a 100644
--- a/src/io/NCWriteGCRM.cpp
+++ b/src/io/NCWriteGCRM.cpp
@@ -123,6 +123,21 @@ ErrorCode NCWriteGCRM::collect_variable_data(std::vector<std::string>& var_names
{
NCWriteHelper::collect_variable_data(var_names, tstep_nums);
+ std::vector<std::string>& dimNames = _writeNC->dimNames;
+ std::vector<int>& dimLens = _writeNC->dimLens;
+
+ // Dimension indices for other optional levels
+ std::vector<unsigned int> opt_lev_dims;
+
+ unsigned int lev_idx;
+ std::vector<std::string>::iterator vecIt;
+
+ // Get index of interface levels
+ if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "interfaces")) != dimNames.end()) {
+ lev_idx = vecIt - dimNames.begin();
+ opt_lev_dims.push_back(lev_idx);
+ }
+
std::map<std::string, WriteNC::VarData>& varInfo = _writeNC->varInfo;
for (size_t i = 0; i < var_names.size(); i++) {
@@ -132,14 +147,22 @@ ErrorCode NCWriteGCRM::collect_variable_data(std::vector<std::string>& var_names
ERRORR(MB_FAILURE, "Can't find one variable.");
WriteNC::VarData& currentVarData = vit->second;
-#ifndef NDEBUG
std::vector<int>& varDims = currentVarData.varDims;
-#endif
// Skip edge variables, if there are no edges
if (localEdgesOwned.empty() && currentVarData.entLoc == WriteNC::ENTLOCEDGE)
continue;
+ // If layers dimension is not found, try other optional levels such as interfaces
+ if (std::find(varDims.begin(), varDims.end(), levDim) == varDims.end()) {
+ for (unsigned int j = 0; j < opt_lev_dims.size(); j++) {
+ if (std::find(varDims.begin(), varDims.end(), opt_lev_dims[j]) != varDims.end()) {
+ currentVarData.numLev = dimLens[opt_lev_dims[j]];
+ break;
+ }
+ }
+ }
+
// Skip set variables, which were already processed in NCWriteHelper::collect_variable_data()
if (WriteNC::ENTLOCSET == currentVarData.entLoc)
continue;
diff --git a/src/io/NCWriteMPAS.cpp b/src/io/NCWriteMPAS.cpp
index 0ece324..512c1d5 100644
--- a/src/io/NCWriteMPAS.cpp
+++ b/src/io/NCWriteMPAS.cpp
@@ -126,25 +126,25 @@ ErrorCode NCWriteMPAS::collect_variable_data(std::vector<std::string>& var_names
std::vector<std::string>& dimNames = _writeNC->dimNames;
std::vector<int>& dimLens = _writeNC->dimLens;
- // Dimension numbers for other optional levels
+ // Dimension indices for other optional levels
std::vector<unsigned int> opt_lev_dims;
unsigned int lev_idx;
std::vector<std::string>::iterator vecIt;
- // Get number of vertex levels P1
+ // Get index of vertex levels P1
if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP1")) != dimNames.end()) {
lev_idx = vecIt - dimNames.begin();
opt_lev_dims.push_back(lev_idx);
}
- // Get number of vertex levels P2
+ // Get index of vertex levels P2
if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP2")) != dimNames.end()) {
lev_idx = vecIt - dimNames.begin();
opt_lev_dims.push_back(lev_idx);
}
- // Get number of soil levels
+ // Get index of soil levels
if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "nSoilLevels")) != dimNames.end()) {
lev_idx = vecIt - dimNames.begin();
opt_lev_dims.push_back(lev_idx);
diff --git a/src/parallel/ParallelComm.cpp b/src/parallel/ParallelComm.cpp
index 769bace..10ce709 100644
--- a/src/parallel/ParallelComm.cpp
+++ b/src/parallel/ParallelComm.cpp
@@ -7146,7 +7146,8 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
recv_tag_reqs[3*ind + 1], // this is for receiving the second message
recv_tag_reqs[3*ind + 2], // this would be for ack, but it is not used; consider removing it
incoming,
- localOwnedBuffs[ind], sendReqs[3*ind+1], // send reg for sendig the second message
+ localOwnedBuffs[ind],
+ sendReqs[3*ind+1], // send request for sending the second message
sendReqs[3*ind+2], // this is for sending the ack
done);
RRA("Failed to resize recv buffer.");
@@ -7284,8 +7285,8 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
// post ghost irecv's for all interface procs
// index greqs the same as buffer/sharing procs indices
- std::vector<MPI_Request> recv_tag_reqs(2*buffProcs.size(), MPI_REQUEST_NULL),
- sent_ack_reqs(buffProcs.size(), MPI_REQUEST_NULL);
+ std::vector<MPI_Request> recv_tag_reqs(3*buffProcs.size(), MPI_REQUEST_NULL);
+
std::vector<unsigned int>::iterator sit;
int ind;
@@ -7300,7 +7301,7 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
success = MPI_Irecv(remoteOwnedBuffs[ind]->mem_ptr, INITIAL_BUFF_SIZE,
MPI_UNSIGNED_CHAR, *sit,
MB_MESG_TAGS_SIZE, procConfig.proc_comm(),
- &recv_tag_reqs[2*ind]);
+ &recv_tag_reqs[3*ind]);
if (success != MPI_SUCCESS) {
result = MB_FAILURE;
RRA("Failed to post irecv in ghost exchange.");
@@ -7310,7 +7311,7 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
// pack and send tags from this proc to others
// make sendReqs vector to simplify initialization
- sendReqs.resize(2*buffProcs.size(), MPI_REQUEST_NULL);
+ sendReqs.resize(3*buffProcs.size(), MPI_REQUEST_NULL);
// take all shared entities if incoming list is empty
Range entities;
@@ -7367,8 +7368,8 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
RRA("Failed to count buffer in pack_send_tag.");
// now send it
- result = send_buffer(*sit, localOwnedBuffs[ind], MB_MESG_TAGS_SIZE, sendReqs[2*ind],
- recv_tag_reqs[2*ind+1], &dum_ack_buff, incoming);
+ result = send_buffer(*sit, localOwnedBuffs[ind], MB_MESG_TAGS_SIZE, sendReqs[3*ind],
+ recv_tag_reqs[3*ind+2], &dum_ack_buff, incoming);
RRA("Failed to send buffer.");
}
@@ -7376,12 +7377,14 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
// receive/unpack tags
while (incoming) {
MPI_Status status;
+ int index_in_recv_requests;
PRINT_DEBUG_WAITANY(recv_tag_reqs, MB_MESG_TAGS_SIZE, procConfig.proc_rank());
- success = MPI_Waitany(2*buffProcs.size(), &recv_tag_reqs[0], &ind, &status);
+ success = MPI_Waitany(3*buffProcs.size(), &recv_tag_reqs[0], &index_in_recv_requests, &status);
if (MPI_SUCCESS != success) {
result = MB_FAILURE;
RRA("Failed in waitany in ghost exchange.");
}
+ ind = index_in_recv_requests/3;
PRINT_DEBUG_RECD(status);
@@ -7390,15 +7393,19 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
bool done = false;
std::vector<EntityHandle> dum_vec;
- result = recv_buffer(MB_MESG_TAGS_SIZE, status, remoteOwnedBuffs[ind/2],
- recv_tag_reqs[ind/2 * 2], recv_tag_reqs[ind/2 * 2 + 1],
- incoming, localOwnedBuffs[ind/2], sendReqs[ind/2*2], sendReqs[ind/2*2+1],
- done);
+ result = recv_buffer(MB_MESG_TAGS_SIZE, status,
+ remoteOwnedBuffs[ind],
+ recv_tag_reqs[3*ind+1], // this is for receiving the second message
+ recv_tag_reqs[3*ind+2], // this would be for ack, but it is not used; consider removing it
+ incoming, localOwnedBuffs[ind],
+ sendReqs[3*ind+1],// send request for sending the second message
+ sendReqs[3*ind+2], // this is for sending the ack
+ done);
RRA("Failed to resize recv buffer.");
if (done) {
- remoteOwnedBuffs[ind/2]->reset_ptr(sizeof(int));
- result = unpack_tags(remoteOwnedBuffs[ind/2]->buff_ptr,
- dum_vec, true, buffProcs[ind/2], &mpi_op);
+ remoteOwnedBuffs[ind]->reset_ptr(sizeof(int));
+ result = unpack_tags(remoteOwnedBuffs[ind]->buff_ptr,
+ dum_vec, true, buffProcs[ind], &mpi_op);
RRA("Failed to recv-unpack-tag message.");
}
}
@@ -7408,8 +7415,8 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
success = MPI_Barrier(procConfig.proc_comm());
}
else {
- MPI_Status status[2*MAX_SHARING_PROCS];
- success = MPI_Waitall(2*buffProcs.size(), &sendReqs[0], status);
+ MPI_Status status[3*MAX_SHARING_PROCS];
+ success = MPI_Waitall(3*buffProcs.size(), &sendReqs[0], status);
}
if (MPI_SUCCESS != success) {
result = MB_FAILURE;
@@ -7421,158 +7428,6 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
return MB_SUCCESS;
}
- /*
- ErrorCode ParallelComm::exchange_tags( Tag src_tag,
- Tag dst_tag,
- const Range& entities )
- {
- ErrorCode result;
- int success;
-
- // get all procs interfacing to this proc
- std::set<unsigned int> exch_procs;
- result = get_comm_procs(exch_procs);
-
- // post ghost irecv's for all interface procs
- // index greqs the same as buffer/sharing procs indices
- std::vector<MPI_Request> recv_reqs(MAX_SHARING_PROCS, MPI_REQUEST_NULL);
- std::vector<MPI_Status> gstatus(MAX_SHARING_PROCS);
- std::vector<unsigned int>::iterator sit;
- int ind;
- for (ind = 0, sit = buffProcs.begin(); sit != buffProcs.end(); sit++, ind++) {
- success = MPI_Irecv(&ghostRBuffs[ind][0], ghostRBuffs[ind].size(),
- MPI_UNSIGNED_CHAR, *sit,
- MB_MESG_ANY, procConfig.proc_comm(),
- &recv_reqs[ind]);
- if (success != MPI_SUCCESS) {
- result = MB_FAILURE;
- RRA("Failed to post irecv in ghost exchange.");
- }
- }
-
- // figure out which entities are shared with which processors
- std::map<int,Range> proc_ents;
- int other_procs[MAX_SHARING_PROCS], num_sharing;
- for (Range::const_iterator i = entities.begin(); i != entities.end(); ++i) {
- int owner;
- result = get_owner( *i, owner );
- RRA("Failed to get entity owner.");
-
- // only send entities that this proc owns
- if ((unsigned)owner != proc_config().proc_rank())
- continue;
-
- result = get_sharing_parts( *i, other_procs, num_sharing );
- RRA("Failed to get procs sharing entity.");
- if (num_sharing == 0) // keep track of non-shared entities for later
- proc_ents[proc_config().proc_rank()].insert( *i );
- for (int j = 0; j < num_sharing; ++j)
- proc_ents[other_procs[j]].insert( *i );
- }
-
- // pack and send tags from this proc to others
- // make sendReqs vector to simplify initialization
- std::fill(sendReqs, sendReqs+MAX_SHARING_PROCS, MPI_REQUEST_NULL);
- std::map<unsigned int,Range>::const_iterator mit;
-
- for (ind = 0, sit = buffProcs.begin(); sit != buffProcs.end(); sit++, ind++) {
-
- // count first
- // buffer needs to begin with the number of tags (one)
- int buff_size = sizeof(int);
- result = packed_tag_size( src_tag, proc_ents[*sit], buff_size );
- RRA("Failed to count buffer in pack_send_tag.");
-
- unsigned char *buff_ptr = &ownerSBuffs[ind][0];
- buff->check_space(ownerSBuffs[ind], buff_ptr, buff_size);
- PACK_INT( buff_ptr, 1 ); // number of tags
- result = pack_tag( src_tag, dst_tag, proc_ents[*sit], proc_ents[*sit],
- ownerSBuffs[ind], buff_ptr, true, *sit );
- RRA("Failed to pack buffer in pack_send_tag.");
-
- // if the message is large, send a first message to tell how large
- if (INITIAL_BUFF_SIZE < buff_size) {
- int tmp_buff_size = -buff_size;
- int success = MPI_Send(&tmp_buff_size, sizeof(int), MPI_UNSIGNED_CHAR,
- *sit, MB_MESG_SIZE, procConfig.proc_comm());
- if (success != MPI_SUCCESS) return MB_FAILURE;
- }
-
- // send the buffer
- success = MPI_Isend(&ownerSBuffs[ind][0], buff_size, MPI_UNSIGNED_CHAR, *sit,
- MB_MESG_TAGS, procConfig.proc_comm(), &sendReqs[ind]);
- if (success != MPI_SUCCESS) return MB_FAILURE;
- }
-
- // receive/unpack tags
- int num_incoming = exch_procs.size();
-
- while (num_incoming) {
- int ind;
- MPI_Status status;
- success = MPI_Waitany(MAX_SHARING_PROCS, &recv_reqs[0], &ind, &status);
- if (MPI_SUCCESS != success) {
- result = MB_FAILURE;
- RRA("Failed in waitany in ghost exchange.");
- }
-
- // ok, received something; decrement incoming counter
- num_incoming--;
-
- int new_size;
- unsigned char *buff_ptr;
- Range dum_range;
-
- // branch on message type
- switch (status.MPI_TAG) {
- case MB_MESG_SIZE:
- // incoming message just has size; resize buffer and re-call recv,
- // then re-increment incoming count
- assert(ind < MAX_SHARING_PROCS);
- new_size = *((int*)&ghostRBuffs[ind][0]);
- assert(0 > new_size);
- result = recv_size_buff(buffProcs[ind], ghostRBuffs[ind], recv_reqs[ind],
- MB_MESG_TAGS);
- RRA("Failed to resize recv buffer.");
- num_incoming++;
- break;
- case MB_MESG_TAGS:
- // incoming ghost entities; process
- buff_ptr = &ghostRBuffs[ind][0];
- result = unpack_tags(buff_ptr, dum_range, true,
- buffProcs[ind]);
- RRA("Failed to recv-unpack-tag message.");
- break;
- default:
- result = MB_FAILURE;
- RRA("Failed to get message of correct type in exch_tags.");
- break;
- }
- }
-
- // ok, now wait
- MPI_Status status[MAX_SHARING_PROCS];
- success = MPI_Waitall(MAX_SHARING_PROCS, &sendReqs[0], status);
- if (MPI_SUCCESS != success) {
- result = MB_FAILURE;
- RRA("Failure in waitall in tag exchange.");
- }
-
- // if src and destination tags aren't the same, need to copy
- // values for local entities
- if (src_tag != dst_tag) {
- const Range& myents = proc_ents[proc_config().proc_rank()];
- std::vector<const void*> data_ptrs(myents.size());
- std::vector<int> data_sizes(myents.size());
- result = get_moab()->tag_get_data( src_tag, myents, &data_ptrs[0], &data_sizes[0] );
- RRA("Failure to get pointers to local data.");
- result = get_moab()->tag_set_data( dst_tag, myents, &data_ptrs[0], &data_sizes[0] );
- RRA("Failure to get pointers to local data.");
- }
-
- return MB_SUCCESS;
- }
- */
//! return sharedp tag
Tag ParallelComm::sharedp_tag()
@@ -8719,8 +8574,7 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
// post ghost irecv's for all interface procs
// index requests the same as buffer/sharing procs indices
- std::vector<MPI_Request> recv_intx_reqs(2 * buffProcs.size(), MPI_REQUEST_NULL),
- sent_ack_reqs(buffProcs.size(), MPI_REQUEST_NULL);
+ std::vector<MPI_Request> recv_intx_reqs(3 * buffProcs.size(), MPI_REQUEST_NULL);
std::vector<unsigned int>::iterator sit;
int ind;
@@ -8734,7 +8588,7 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
success = MPI_Irecv(remoteOwnedBuffs[ind]->mem_ptr, INITIAL_BUFF_SIZE,
MPI_UNSIGNED_CHAR, *sit, MB_MESG_TAGS_SIZE, procConfig.proc_comm(),
- &recv_intx_reqs[2 * ind]);
+ &recv_intx_reqs[3 * ind]);
if (success != MPI_SUCCESS) {
result = MB_FAILURE;
RRA("Failed to post irecv in settle intersection point.");
@@ -8744,7 +8598,7 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
// pack and send intersection points from this proc to others
// make sendReqs vector to simplify initialization
- sendReqs.resize(2 * buffProcs.size(), MPI_REQUEST_NULL);
+ sendReqs.resize(3 * buffProcs.size(), MPI_REQUEST_NULL);
// take all shared entities if incoming list is empty
Range & entities = shared_edges_owned;
@@ -8820,7 +8674,7 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
// now send it
result = send_buffer(*sit, localOwnedBuffs[ind], MB_MESG_TAGS_SIZE,
- sendReqs[2 * ind], recv_intx_reqs[2 * ind + 1], &dum_ack_buff, incoming);
+ sendReqs[3 * ind], recv_intx_reqs[3 * ind + 2], &dum_ack_buff, incoming);
RRA("Failed to send buffer.");
}
@@ -8828,13 +8682,16 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
// receive/unpack intx points
while (incoming) {
MPI_Status status;
+ int index_in_recv_requests;
PRINT_DEBUG_WAITANY(recv_intx_reqs, MB_MESG_TAGS_SIZE, procConfig.proc_rank());
- success = MPI_Waitany(2 * buffProcs.size(), &recv_intx_reqs[0], &ind,
- &status);
+ success = MPI_Waitany(3 * buffProcs.size(), &recv_intx_reqs[0],
+ &index_in_recv_requests, &status);
if (MPI_SUCCESS != success) {
result = MB_FAILURE;
RRA("Failed in waitany in ghost exchange.");
}
+ // processor index in the list is divided by 3
+ ind = index_in_recv_requests/3;
PRINT_DEBUG_RECD(status);
@@ -8843,13 +8700,18 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
bool done = false;
std::vector<EntityHandle> dum_vec;
- result = recv_buffer(MB_MESG_TAGS_SIZE, status, remoteOwnedBuffs[ind / 2],
- recv_intx_reqs[ind / 2 * 2], recv_intx_reqs[ind / 2 * 2 + 1], incoming,
- localOwnedBuffs[ind / 2], sendReqs[ind / 2 * 2],
- sendReqs[ind / 2 * 2 + 1], done);
+ result = recv_buffer(MB_MESG_TAGS_SIZE, status,
+ remoteOwnedBuffs[ind],
+ recv_intx_reqs[3*ind+1], // this is for receiving the second message
+ recv_intx_reqs[3*ind+2], // this would be for ack, but it is not used; consider removing it
+ incoming,
+ localOwnedBuffs[ind],
+ sendReqs[3*ind+1], // send request for sending the second message
+ sendReqs[3*ind+2], // this is for sending the ack
+ done);
RRA("Failed to resize recv buffer.");
if (done) {
- Buffer * buff = remoteOwnedBuffs[ind / 2];
+ Buffer * buff = remoteOwnedBuffs[ind];
buff->reset_ptr(sizeof(int));
/*result = unpack_tags(remoteOwnedBuffs[ind / 2]->buff_ptr, dum_vec, true,
buffProcs[ind / 2]);*/
@@ -8915,8 +8777,8 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
if (myDebug->get_verbosity() == 5) {
success = MPI_Barrier(procConfig.proc_comm());
} else {
- MPI_Status status[2 * MAX_SHARING_PROCS];
- success = MPI_Waitall(2 * buffProcs.size(), &sendReqs[0], status);
+ MPI_Status status[3 * MAX_SHARING_PROCS];
+ success = MPI_Waitall(3 * buffProcs.size(), &sendReqs[0], status);
}
if (MPI_SUCCESS != success) {
result = MB_FAILURE;
diff --git a/test/io/read_gcrm_nc.cpp b/test/io/read_gcrm_nc.cpp
index 1304495..35d6bcb 100644
--- a/test/io/read_gcrm_nc.cpp
+++ b/test/io/read_gcrm_nc.cpp
@@ -27,7 +27,8 @@ void test_gather_onevar(); // Test gather set with one variable
void get_options(std::string& opts);
const double eps = 1e-6;
-const int layers = 256;
+const int layers = 3;
+const int interfaces = 3;
int main(int argc, char* argv[])
{
@@ -80,8 +81,7 @@ void test_read_all()
// Make check runs this test on one processor
if (1 == procs) {
- // For each tag, check values on two entities
- // There are 256 layers, only check on first two
+ // For u, wind and vorticity, check tag values on two entities
double val[2 * layers];
// Check tags for vertex variable u
@@ -91,7 +91,7 @@ void test_read_all()
rval = mb.tag_get_handle("u1", layers, MB_TYPE_DOUBLE, u_tag1);
CHECK_ERR(rval);
- // Get vertices (1280 edges)
+ // Get vertices (1280 vertices)
Range verts;
rval = mb.get_entities_by_type(0, MBVERTEX, verts);
CHECK_ERR(rval);
@@ -101,6 +101,7 @@ void test_read_all()
// Check u tag values on first and last vertices
EntityHandle vert_ents[] = {verts[0], verts[1279]};
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(u_tag0, vert_ents, 2, val);
CHECK_ERR(rval);
@@ -138,6 +139,7 @@ void test_read_all()
// Check wind tag values on first and last edges
EntityHandle edge_ents[] = {edges[0], edges[1919]};
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(wind_tag0, edge_ents, 2, val);
CHECK_ERR(rval);
@@ -177,6 +179,7 @@ void test_read_all()
// Check vorticity tag values on first and last cells
EntityHandle cell_ents[] = {cells[0], cells[641]};
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(vorticity_tag0, cell_ents, 2, val);
CHECK_ERR(rval);
@@ -196,6 +199,38 @@ void test_read_all()
// Layer 1
CHECK_REAL_EQUAL(3.534306, val[0 * layers + 1], eps);
CHECK_REAL_EQUAL(-0.540262, val[1 * layers + 1], eps);
+
+ // Check tags for cell variable pressure
+ Tag pressure_tag0, pressure_tag1;
+ rval = mb.tag_get_handle("pressure0", interfaces, MB_TYPE_DOUBLE, pressure_tag0);
+ CHECK_ERR(rval);
+ rval = mb.tag_get_handle("pressure1", interfaces, MB_TYPE_DOUBLE, pressure_tag1);
+ CHECK_ERR(rval);
+
+ // For pressure, check tag values on two cells
+ double pressure_val[2 * interfaces];
+
+ // Check pressure tag values on first and last cells
+ // Only check first two interfaces
+ // Timestep 0
+ rval = mb.tag_get_data(pressure_tag0, cell_ents, 2, pressure_val);
+ CHECK_ERR(rval);
+ // Interface 0
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_val[0 * interfaces], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_val[1 * interfaces], 1e-7);
+ // Interface 1
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_val[0 * interfaces + 1], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_val[1 * interfaces + 1], 1e-7);
+
+ // Timestep 1
+ rval = mb.tag_get_data(pressure_tag1, cell_ents, 2, pressure_val);
+ CHECK_ERR(rval);
+ // Interface 0
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_val[0 * interfaces], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_val[1 * interfaces], 1e-8);
+ // Interface 1
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_val[0 * interfaces + 1], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_val[1 * interfaces + 1], 1e-8);
}
}
@@ -238,9 +273,9 @@ void test_read_onevar()
// Check vorticity tag values on 4 cells: first cell, two median cells, and last cell
EntityHandle cell_ents[] = {cells[0], cells[320], cells[321], cells[641]};
- // There are 256 layers, only check on first two
double vorticity_val[4 * layers];
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(vorticity_tag0, cell_ents, 4, vorticity_val);
CHECK_ERR(rval);
@@ -405,9 +440,9 @@ void test_read_novars()
// Check vorticity tag values on 4 cells: first cell, two median cells, and last cell
EntityHandle cell_ents[] = {cells[0], cells[320], cells[321], cells[641]};
- // There are 256 layers, only check on first two
double vorticity_val[4 * layers];
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(vorticity_tag0, cell_ents, 4, vorticity_val);
CHECK_ERR(rval);
diff --git a/test/io/write_nc.cpp b/test/io/write_nc.cpp
index d59829d..bd7a9e9 100644
--- a/test/io/write_nc.cpp
+++ b/test/io/write_nc.cpp
@@ -56,7 +56,7 @@ void test_mpas_check_vars();
// GCRM
void test_gcrm_read_write_vars();
-//void test_gcrm_check_vars();
+void test_gcrm_check_vars();
// Test timestep option
void test_eul_read_write_timestep();
@@ -106,7 +106,7 @@ int main(int argc, char* argv[])
result += RUN_TEST(test_mpas_check_vars);
result += RUN_TEST(test_gcrm_read_write_vars);
- //result += RUN_TEST(test_gcrm_check_vars);
+ result += RUN_TEST(test_gcrm_check_vars);
result += RUN_TEST(test_eul_read_write_timestep);
result += RUN_TEST(test_eul_check_timestep);
@@ -588,7 +588,7 @@ void test_homme_check_T()
}
}
-// Write vertex variable vorticity, edge variable u and cell veriable ke
+// Write vertex variable vorticity, edge variable u and cell variable ke
void test_mpas_read_write_vars()
{
int procs = 1;
@@ -632,7 +632,7 @@ void test_mpas_read_write_vars()
CHECK_ERR(rval);
}
-// Check vertex variable vorticity, edge variable u and cell veriable ke
+// Check vertex variable vorticity, edge variable u and cell variable ke
void test_mpas_check_vars()
{
int rank = 0;
@@ -747,7 +747,8 @@ void test_mpas_check_vars()
}
}
-// Write vertex variable vorticity, edge variable u and cell veriable ke
+// Write vertex variable u, edge variable wind, cell variable vorticity (on layers),
+// and cell variable pressure (on interfaces)
void test_gcrm_read_write_vars()
{
int procs = 1;
@@ -772,15 +773,15 @@ void test_gcrm_read_write_vars()
ErrorCode rval = mb.create_meshset(MESHSET_SET, set);
CHECK_ERR(rval);
- // Read non-set variables vorticity (cells) and u (corners)
- read_opts += ";VARIABLE=vorticity,u;DEBUG_IO=0";
+ // Read non-set variables u, wind, vorticity and pressure
+ read_opts += ";VARIABLE=u,wind,vorticity,pressure;DEBUG_IO=0";
if (procs > 1)
read_opts += ";PARALLEL_RESOLVE_SHARED_ENTS";
rval = mb.load_file(example_gcrm, &set, read_opts.c_str());
CHECK_ERR(rval);
- // Write variables vorticity, u
- std::string write_opts = ";;VARIABLE=vorticity,u;DEBUG_IO=0";
+ // Write variables u, wind, vorticity and pressure
+ std::string write_opts = ";;VARIABLE=u,wind,vorticity,pressure;DEBUG_IO=0";
#ifdef USE_MPI
// Use parallel options
write_opts += ";PARALLEL=WRITE_PART";
@@ -792,6 +793,169 @@ void test_gcrm_read_write_vars()
CHECK_ERR(rval);
}
+// Check vertex variable u, edge variable wind, cell variable vorticity (on layers),
+// and cell variable pressure (on interfaces)
+void test_gcrm_check_vars()
+{
+ int rank = 0;
+ int procs = 1;
+#ifdef USE_MPI
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &procs);
+#endif
+
+// We will not test NC writer in parallel without pnetcdf support
+#ifndef PNETCDF_FILE
+ if (procs > 1)
+ return;
+#endif
+
+ if (0 == rank) {
+ int ncid;
+ int success;
+
+ std::string filename;
+ if (procs > 1)
+ filename = "test_par_gcrm_vars.nc";
+ else
+ filename = "test_gcrm_vars.nc";
+
+#ifdef PNETCDF_FILE
+ success = NCFUNC(open)(MPI_COMM_SELF, filename.c_str(), NC_NOWRITE, MPI_INFO_NULL, &ncid);
+#else
+ success = NCFUNC(open)(filename.c_str(), NC_NOWRITE, &ncid);
+#endif
+ CHECK_EQUAL(0, success);
+
+ int u_id;
+ success = NCFUNC(inq_varid)(ncid, "u", &u_id);
+ CHECK_EQUAL(0, success);
+
+ int wind_id;
+ success = NCFUNC(inq_varid)(ncid, "wind", &wind_id);
+ CHECK_EQUAL(0, success);
+
+ int vorticity_id;
+ success = NCFUNC(inq_varid)(ncid, "vorticity", &vorticity_id);
+ CHECK_EQUAL(0, success);
+
+ int pressure_id;
+ success = NCFUNC(inq_varid)(ncid, "pressure", &pressure_id);
+ CHECK_EQUAL(0, success);
+
+#ifdef PNETCDF_FILE
+ // Enter independent I/O mode
+ success = NCFUNC(begin_indep_data)(ncid);
+ CHECK_EQUAL(0, success);
+#endif
+
+ NCDF_SIZE start[] = {0, 0, 0};
+ NCDF_SIZE count[] = {2, 1, 2}; // Read two timesteps and two levels
+
+ // Read variable u on all 1280 vertices
+ count[1] = 1280;
+ double u_vals[1280 * 4];
+ success = NCFUNC(get_vara_double)(ncid, u_id, start, count, u_vals);
+ CHECK_EQUAL(0, success);
+
+ // Read variable wind on all 1920 edges
+ count[1] = 1920;
+ double wind_vals[1920 * 4];
+ success = NCFUNC(get_vara_double)(ncid, wind_id, start, count, wind_vals);
+ CHECK_EQUAL(0, success);
+
+ // Read variable vorticity on all 642 cells
+ count[1] = 642;
+ double vorticity_vals[642 * 4];
+ success = NCFUNC(get_vara_double)(ncid, vorticity_id, start, count, vorticity_vals);
+ CHECK_EQUAL(0, success);
+
+ // Read variable pressure on all 642 cells
+ double pressure_vals[642 * 4];
+ success = NCFUNC(get_vara_double)(ncid, pressure_id, start, count, pressure_vals);
+ CHECK_EQUAL(0, success);
+
+#ifdef PNETCDF_FILE
+ // End independent I/O mode
+ success = NCFUNC(end_indep_data)(ncid);
+ CHECK_EQUAL(0, success);
+#endif
+
+ const double eps = 1e-6;
+
+ // Check u values on first and last vertices
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(-4.839992, u_vals[0], eps);
+ CHECK_REAL_EQUAL(-3.699257, u_vals[1279 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-4.839925, u_vals[0 + 1], eps);
+ CHECK_REAL_EQUAL(-3.699206, u_vals[1279 * 2 + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(-4.712473, u_vals[0 + 1280 * 2], eps);
+ CHECK_REAL_EQUAL(-3.601793, u_vals[1279 * 2 + 1280 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-4.712409, u_vals[0 + 1 + 1280 * 2], eps);
+ CHECK_REAL_EQUAL(-3.601743, u_vals[1279 * 2 + 1 + 1280 * 2], eps);
+
+ // Check wind values on first and last edges
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(-5.081991, wind_vals[0], eps);
+ CHECK_REAL_EQUAL(-6.420274, wind_vals[1919 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-5.081781, wind_vals[0 + 1], eps);
+ CHECK_REAL_EQUAL(-6.419831, wind_vals[1919 * 2 + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(-4.948097, wind_vals[0 + 1920 * 2], eps);
+ CHECK_REAL_EQUAL(-6.251121, wind_vals[1919 * 2 + 1920 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-4.947892, wind_vals[0 + 1 + 1920 * 2], eps);
+ CHECK_REAL_EQUAL(-6.250690, wind_vals[1919 * 2 + 1 + 1920 * 2], eps);
+
+ // Check vorticity values on first and last cells
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(3.629994, vorticity_vals[0], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity_vals[641 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.629944, vorticity_vals[0 + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity_vals[641 * 2 + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(3.534355, vorticity_vals[0 + 642 * 2], eps);
+ CHECK_REAL_EQUAL(-0.540269, vorticity_vals[641 * 2 + 642 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.534306, vorticity_vals[0 + 1 + 642 * 2], eps);
+ CHECK_REAL_EQUAL(-0.540262, vorticity_vals[641 * 2 + 1 + 642 * 2], eps);
+
+ // Check pressure values on first and last cells
+ // Timestep 0
+ // Interface 0
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_vals[0], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_vals[641 * 2], 1e-7);
+ // Interface 1
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_vals[0 + 1], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_vals[641 * 2 + 1], 1e-7);
+
+ // Timestep 1
+ // Interface 0
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_vals[0 + 642 * 2], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_vals[641 * 2 + 642 * 2], 1e-8);
+ // Interface 1
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_vals[0 + 1 + 642 * 2], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_vals[641 * 2 + 1 + 642 * 2], 1e-8);
+
+ success = NCFUNC(close)(ncid);
+ CHECK_EQUAL(0, success);
+ }
+}
+
// Read non-set variable T on all 3 timesteps, and write only timestep 2
void test_eul_read_write_timestep()
{
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/fathomteam/moab/commits/80a930038ada/
Changeset: 80a930038ada
Branch: None
User: makeclean
Date: 2014-06-06 20:54:58
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 4 files
diff --git a/src/io/NCHelperGCRM.cpp b/src/io/NCHelperGCRM.cpp
index 6870808..cb176f3 100644
--- a/src/io/NCHelperGCRM.cpp
+++ b/src/io/NCHelperGCRM.cpp
@@ -339,10 +339,6 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
ERRORS(success, "Failed on wait_all.");
#endif
- // GCRM is 0 based, convert vertex indices from 0 to 1 based
- for (std::size_t idx = 0; idx < vertices_on_local_cells.size(); idx++)
- vertices_on_local_cells[idx] += 1;
-
// Correct vertices_on_local_cells array. Pentagons as hexagons should have
// a connectivity like 123455 and not 122345
for (int local_cell_idx = 0; local_cell_idx < nLocalCells; local_cell_idx++) {
@@ -358,6 +354,10 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
}
}
+ // GCRM is 0 based, convert vertex indices from 0 to 1 based
+ for (std::size_t idx = 0; idx < vertices_on_local_cells.size(); idx++)
+ vertices_on_local_cells[idx] += 1;
+
// Create local vertices
EntityHandle start_vertex;
ErrorCode rval = create_local_vertices(vertices_on_local_cells, start_vertex);
@@ -374,7 +374,6 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
ERRORR(rval, "Failed to create local cells for GCRM mesh.");
if (createGatherSet) {
-#if 0
EntityHandle gather_set;
rval = _readNC->readMeshIface->create_gather_set(gather_set);
ERRORR(rval, "Failed to create gather set.");
@@ -393,7 +392,6 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
// Create gather set cells with padding
rval = create_padded_gather_set_cells(gather_set, start_gather_set_vertex);
ERRORR(rval, "Failed to create gather set cells for GCRM mesh.");
-#endif
}
return MB_SUCCESS;
@@ -973,11 +971,10 @@ ErrorCode NCHelperGCRM::create_local_vertices(const std::vector<int>& vertices_o
// Convert lon/lat/rad to x/y/z
double* zptr = arrays[2];
- //const double pideg = acos(-1.0) / 180.0;
double rad = 8000.0 + levVals[0];
for (int i = 0; i < nLocalVertices; i++) {
double cosphi = cos(yptr[i]);
- double zmult = sin(yptr[i]);
+ double zmult = sin(yptr[i]);
double xmult = cosphi * cos(xptr[i]);
double ymult = cosphi * sin(xptr[i]);
xptr[i] = rad * xmult;
@@ -1041,7 +1038,7 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
// GCRM is 0 based, convert edge indices from 0 to 1 based
for (std::size_t idx = 0; idx < edges_on_local_cells.size(); idx++)
- edges_on_local_cells[idx] += 1;
+ edges_on_local_cells[idx] += 1;
// Collect local edges
std::sort(edges_on_local_cells.begin(), edges_on_local_cells.end());
@@ -1115,15 +1112,12 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
ERRORS(success, "Failed on wait_all.");
#endif
- // GCRM is 0 based, convert edge indices from 0 to 1 based
- for (int idx = 0; idx < nLocalEdges*2; idx++)
- vertices_on_local_edges[idx] += 1;
-
// Populate connectivity data for local edges
// Convert in-place from int (stored in the first half) to EntityHandle
// Reading backward is the trick
for (int edge_vert = nLocalEdges * 2 - 1; edge_vert >= 0; edge_vert--) {
- int global_vert_idx = vertices_on_local_edges[edge_vert]; // Global vertex index, 1 based
+ // Note, indices stored in vertices_on_local_edges are 0 based
+ int global_vert_idx = vertices_on_local_edges[edge_vert] + 1; // Global vertex index, 1 based
int local_vert_idx = localGidVerts.index(global_vert_idx); // Local vertex index, 0 based
assert(local_vert_idx != -1);
conn_arr_edges[edge_vert] = start_vertex + local_vert_idx;
@@ -1166,6 +1160,7 @@ ErrorCode NCHelperGCRM::create_padded_local_cells(const std::vector<int>& vertic
// the last vertices repeated for pentagons, e.g. 122345 => 123455
for (int local_cell_idx = 0; local_cell_idx < nLocalCells; local_cell_idx++) {
for (int i = 0; i < EDGES_PER_CELL; i++) {
+ // Note, indices stored in vertices_on_local_cells are 1 based
EntityHandle global_vert_idx = vertices_on_local_cells[local_cell_idx * EDGES_PER_CELL + i]; // Global vertex index, 1 based
int local_vert_idx = localGidVerts.index(global_vert_idx); // Local vertex index, 0 based
assert(local_vert_idx != -1);
@@ -1176,7 +1171,6 @@ ErrorCode NCHelperGCRM::create_padded_local_cells(const std::vector<int>& vertic
return MB_SUCCESS;
}
-#if 0
ErrorCode NCHelperGCRM::create_gather_set_vertices(EntityHandle gather_set, EntityHandle& gather_set_start_vertex)
{
Interface*& mbImpl = _readNC->mbImpl;
@@ -1197,8 +1191,8 @@ ErrorCode NCHelperGCRM::create_gather_set_vertices(EntityHandle gather_set, Enti
// Read x coordinates for gather set vertices
double* xptr = arrays[0];
int xVertexVarId;
- int success = NCFUNC(inq_varid)(_fileId, "xVertex", &xVertexVarId);
- ERRORS(success, "Failed to get variable id of xVertex.");
+ int success = NCFUNC(inq_varid)(_fileId, "grid_corner_lon", &xVertexVarId);
+ ERRORS(success, "Failed to get variable id of grid_corner_lon.");
NCDF_SIZE read_start = 0;
NCDF_SIZE read_count = static_cast<NCDF_SIZE>(nVertices);
#ifdef PNETCDF_FILE
@@ -1206,49 +1200,44 @@ ErrorCode NCHelperGCRM::create_gather_set_vertices(EntityHandle gather_set, Enti
success = NCFUNC(begin_indep_data)(_fileId);
ERRORS(success, "Failed to begin independent I/O mode.");
success = NCFUNCG(_vara_double)(_fileId, xVertexVarId, &read_start, &read_count, xptr);
- ERRORS(success, "Failed to read xVertex data.");
+ ERRORS(success, "Failed to read grid_corner_lon data.");
success = NCFUNC(end_indep_data)(_fileId);
ERRORS(success, "Failed to end independent I/O mode.");
#else
success = NCFUNCG(_vara_double)(_fileId, xVertexVarId, &read_start, &read_count, xptr);
- ERRORS(success, "Failed to read xVertex data.");
+ ERRORS(success, "Failed to read grid_corner_lon data.");
#endif
// Read y coordinates for gather set vertices
double* yptr = arrays[1];
int yVertexVarId;
- success = NCFUNC(inq_varid)(_fileId, "yVertex", &yVertexVarId);
- ERRORS(success, "Failed to get variable id of yVertex.");
+ success = NCFUNC(inq_varid)(_fileId, "grid_corner_lat", &yVertexVarId);
+ ERRORS(success, "Failed to get variable id of grid_corner_lat.");
#ifdef PNETCDF_FILE
// Enter independent I/O mode, since this read is only for the gather processor
success = NCFUNC(begin_indep_data)(_fileId);
ERRORS(success, "Failed to begin independent I/O mode.");
success = NCFUNCG(_vara_double)(_fileId, yVertexVarId, &read_start, &read_count, yptr);
- ERRORS(success, "Failed to read yVertex data.");
+ ERRORS(success, "Failed to read grid_corner_lat data.");
success = NCFUNC(end_indep_data)(_fileId);
ERRORS(success, "Failed to end independent I/O mode.");
#else
success = NCFUNCG(_vara_double)(_fileId, yVertexVarId, &read_start, &read_count, yptr);
- ERRORS(success, "Failed to read yVertex data.");
+ ERRORS(success, "Failed to read grid_corner_lat data.");
#endif
- // Read z coordinates for gather set vertices
+ // Convert lon/lat/rad to x/y/z
double* zptr = arrays[2];
- int zVertexVarId;
- success = NCFUNC(inq_varid)(_fileId, "zVertex", &zVertexVarId);
- ERRORS(success, "Failed to get variable id of zVertex.");
-#ifdef PNETCDF_FILE
- // Enter independent I/O mode, since this read is only for the gather processor
- success = NCFUNC(begin_indep_data)(_fileId);
- ERRORS(success, "Failed to begin independent I/O mode.");
- success = NCFUNCG(_vara_double)(_fileId, zVertexVarId, &read_start, &read_count, zptr);
- ERRORS(success, "Failed to read zVertex data.");
- success = NCFUNC(end_indep_data)(_fileId);
- ERRORS(success, "Failed to end independent I/O mode.");
-#else
- success = NCFUNCG(_vara_double)(_fileId, zVertexVarId, &read_start, &read_count, zptr);
- ERRORS(success, "Failed to read zVertex data.");
-#endif
+ double rad = 8000.0 + levVals[0];
+ for (int i = 0; i < nVertices; i++) {
+ double cosphi = cos(yptr[i]);
+ double zmult = sin(yptr[i]);
+ double xmult = cosphi * cos(xptr[i]);
+ double ymult = cosphi * sin(xptr[i]);
+ xptr[i] = rad * xmult;
+ yptr[i] = rad * ymult;
+ zptr[i] = rad * zmult;
+ }
// Get ptr to GID memory for gather set vertices
int count = 0;
@@ -1314,8 +1303,8 @@ ErrorCode NCHelperGCRM::create_gather_set_edges(EntityHandle gather_set, EntityH
// Convert in-place from int (stored in the first half) to EntityHandle
// Reading backward is the trick
for (int edge_vert = nEdges * 2 - 1; edge_vert >= 0; edge_vert--) {
- int gather_set_vert_idx = vertices_on_gather_set_edges[edge_vert]; // Global vertex index, 1 based
- gather_set_vert_idx--; // 1 based -> 0 based
+ // Note, indices stored in vertices_on_gather_set_edges are 0 based
+ int gather_set_vert_idx = vertices_on_gather_set_edges[edge_vert]; // Global vertex index, 0 based
// Connectivity array is shifted by where the gather set vertices start
conn_arr_gather_set_edges[edge_vert] = gather_set_start_vertex + gather_set_vert_idx;
}
@@ -1327,26 +1316,6 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
{
Interface*& mbImpl = _readNC->mbImpl;
- // Read number of edges on each gather set cell
- int nEdgesOnCellVarId;
- int success = NCFUNC(inq_varid)(_fileId, "nEdgesOnCell", &nEdgesOnCellVarId);
- ERRORS(success, "Failed to get variable id of nEdgesOnCell.");
- std::vector<int> num_edges_on_gather_set_cells(nCells);
- NCDF_SIZE read_start = 0;
- NCDF_SIZE read_count = static_cast<NCDF_SIZE>(nCells);
-#ifdef PNETCDF_FILE
- // Enter independent I/O mode, since this read is only for the gather processor
- success = NCFUNC(begin_indep_data)(_fileId);
- ERRORS(success, "Failed to begin independent I/O mode.");
- success = NCFUNCG(_vara_int)(_fileId, nEdgesOnCellVarId, &read_start, &read_count, &num_edges_on_gather_set_cells[0]);
- ERRORS(success, "Failed to read nEdgesOnCell data.");
- success = NCFUNC(end_indep_data)(_fileId);
- ERRORS(success, "Failed to end independent I/O mode.");
-#else
- success = NCFUNCG(_vara_int)(_fileId, nEdgesOnCellVarId, &read_start, &read_count, &num_edges_on_gather_set_cells[0]);
- ERRORS(success, "Failed to read nEdgesOnCell data.");
-#endif
-
// Create gather set cells
EntityHandle start_element;
EntityHandle* conn_arr_gather_set_cells = NULL;
@@ -1361,8 +1330,8 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
// Read vertices on each gather set cell (connectivity)
int verticesOnCellVarId;
- success = NCFUNC(inq_varid)(_fileId, "verticesOnCell", &verticesOnCellVarId);
- ERRORS(success, "Failed to get variable id of verticesOnCell.");
+ int success = NCFUNC(inq_varid)(_fileId, "cell_corners", &verticesOnCellVarId);
+ ERRORS(success, "Failed to get variable id of cell_corners.");
// Utilize the memory storage pointed by conn_arr_gather_set_cells
int* vertices_on_gather_set_cells = (int*) conn_arr_gather_set_cells;
NCDF_SIZE read_starts[2] = {0, 0};
@@ -1380,28 +1349,32 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
ERRORS(success, "Failed to read verticesOnCell data.");
#endif
- // Correct gather set cell vertices array in the same way as local cell vertices array,
- // replace the padded vertices with the last vertices in the corresponding cells
+ // Correct gather set cell vertices array in the same way as local cell vertices array
+ // Pentagons as hexagons should have a connectivity like 123455 and not 122345
for (int gather_set_cell_idx = 0; gather_set_cell_idx < nCells; gather_set_cell_idx++) {
- int num_edges = num_edges_on_gather_set_cells[gather_set_cell_idx];
- int idx_in_gather_set_vert_arr = gather_set_cell_idx * EDGES_PER_CELL;
- int last_vert_idx = vertices_on_gather_set_cells[idx_in_gather_set_vert_arr + num_edges - 1];
- for (int i = num_edges; i < EDGES_PER_CELL; i++)
- vertices_on_gather_set_cells[idx_in_gather_set_vert_arr + i] = last_vert_idx;
+ int* pvertex = vertices_on_gather_set_cells + gather_set_cell_idx * EDGES_PER_CELL;
+ for (int k = 0; k < EDGES_PER_CELL - 2; k++) {
+ if (*(pvertex + k) == *(pvertex + k + 1)) {
+ // Shift the connectivity
+ for (int kk = k + 1; kk < EDGES_PER_CELL - 1; kk++)
+ *(pvertex + kk) = *(pvertex + kk + 1);
+ // No need to try next k
+ break;
+ }
+ }
}
// Populate connectivity data for gather set cells
// Convert in-place from int (stored in the first half) to EntityHandle
// Reading backward is the trick
for (int cell_vert = nCells * EDGES_PER_CELL - 1; cell_vert >= 0; cell_vert--) {
- int gather_set_vert_idx = vertices_on_gather_set_cells[cell_vert]; // Global vertex index, 1 based
- gather_set_vert_idx--; // 1 based -> 0 based
+ // Note, indices stored in vertices_on_gather_set_cells are 0 based
+ int gather_set_vert_idx = vertices_on_gather_set_cells[cell_vert]; // Global vertex index, 0 based
// Connectivity array is shifted by where the gather set vertices start
conn_arr_gather_set_cells[cell_vert] = gather_set_start_vertex + gather_set_vert_idx;
}
return MB_SUCCESS;
}
-#endif
} // namespace moab
diff --git a/src/io/NCHelperGCRM.hpp b/src/io/NCHelperGCRM.hpp
index 1e5f55b..160e538 100644
--- a/src/io/NCHelperGCRM.hpp
+++ b/src/io/NCHelperGCRM.hpp
@@ -56,7 +56,6 @@ private:
ErrorCode create_padded_local_cells(const std::vector<int>& vertices_on_local_cells,
EntityHandle start_vertex, Range& faces);
-#if 0
//! Create gather set vertices
ErrorCode create_gather_set_vertices(EntityHandle gather_set, EntityHandle& gather_set_start_vertex);
@@ -65,7 +64,6 @@ private:
//! Create gather set cells with padding (pentagons are padded to hexagons)
ErrorCode create_padded_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex);
-#endif
private:
bool createGatherSet;
diff --git a/test/io/read_gcrm_nc.cpp b/test/io/read_gcrm_nc.cpp
index 35d6bcb..c4a2290 100644
--- a/test/io/read_gcrm_nc.cpp
+++ b/test/io/read_gcrm_nc.cpp
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
result += RUN_TEST(test_read_nomesh);
result += RUN_TEST(test_read_novars);
result += RUN_TEST(test_read_no_edges);
- //result += RUN_TEST(test_gather_onevar);
+ result += RUN_TEST(test_gather_onevar);
#ifdef USE_MPI
fail = MPI_Finalize();
@@ -494,7 +494,80 @@ void test_read_no_edges()
void test_gather_onevar()
{
- // TBD
+ Core moab;
+ Interface& mb = moab;
+
+ EntityHandle file_set;
+ ErrorCode rval = mb.create_meshset(MESHSET_SET, file_set);
+ CHECK_ERR(rval);
+
+ std::string opts;
+ get_options(opts);
+
+ // Read cell variable vorticity and create gather set on processor 0
+ opts += ";VARIABLE=vorticity;GATHER_SET=0";
+ rval = mb.load_file(example, &file_set, opts.c_str());
+ CHECK_ERR(rval);
+
+#ifdef USE_MPI
+ ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
+ int rank = pcomm->proc_config().proc_rank();
+
+ Range cells, cells_owned;
+ rval = mb.get_entities_by_type(file_set, MBPOLYGON, cells);
+ CHECK_ERR(rval);
+
+ // Get local owned cells
+ rval = pcomm->filter_pstatus(cells, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &cells_owned);
+ CHECK_ERR(rval);
+
+ EntityHandle gather_set = 0;
+ if (0 == rank) {
+ // Get gather set
+ ReadUtilIface* readUtilIface;
+ mb.query_interface(readUtilIface);
+ rval = readUtilIface->get_gather_set(gather_set);
+ CHECK_ERR(rval);
+ assert(gather_set != 0);
+ }
+
+ Tag vorticity_tag0, gid_tag;
+ rval = mb.tag_get_handle("vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0, MB_TAG_DENSE);
+ CHECK_ERR(rval);
+
+ rval = mb.tag_get_handle(GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, gid_tag, MB_TAG_DENSE);
+ CHECK_ERR(rval);
+
+ pcomm->gather_data(cells_owned, vorticity_tag0, gid_tag, gather_set, 0);
+
+ if (0 == rank) {
+ // Get gather set cells
+ Range gather_set_cells;
+ rval = mb.get_entities_by_type(gather_set, MBPOLYGON, gather_set_cells);
+ CHECK_ERR(rval);
+ CHECK_EQUAL((size_t)642, gather_set_cells.size());
+ CHECK_EQUAL((size_t)1, gather_set_cells.psize());
+
+ // Check vorticity0 tag values on 4 gather set cells: first cell, two median cells, and last cell
+ EntityHandle cell_ents[] = {gather_set_cells[0], gather_set_cells[320],
+ gather_set_cells[321], gather_set_cells[641]};
+ double vorticity0_val[4 * layers];
+ rval = mb.tag_get_data(vorticity_tag0, cell_ents, 4, vorticity0_val);
+ CHECK_ERR(rval);
+
+ // Only check first two layers
+ // Layer 0
+ CHECK_REAL_EQUAL(3.629994, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(0.131688, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[2 * layers], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[3 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.629944, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(0.131686, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[2 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[3 * layers + 1], eps);
+ }
+#endif
}
void get_options(std::string& opts)
diff --git a/test/parallel/gcrm_par.cpp b/test/parallel/gcrm_par.cpp
index f433759..c6b6fe4 100644
--- a/test/parallel/gcrm_par.cpp
+++ b/test/parallel/gcrm_par.cpp
@@ -54,8 +54,8 @@ int main(int argc, char* argv[])
result += RUN_TEST(test_read_mesh_parallel_rcbzoltan);
#endif
- //result += RUN_TEST(test_gather_onevar_on_rank0);
- //result += RUN_TEST(test_gather_onevar_on_rank1);
+ result += RUN_TEST(test_gather_onevar_on_rank0);
+ result += RUN_TEST(test_gather_onevar_on_rank1);
result += RUN_TEST(test_multiple_loads_of_same_file);
@@ -509,7 +509,7 @@ void gather_one_cell_var(int gather_set_rank)
}
Tag vorticity_tag0, gid_tag;
- rval = mb.tag_get_handle("vorticity0", 1, MB_TYPE_DOUBLE, vorticity_tag0, MB_TAG_DENSE);
+ rval = mb.tag_get_handle("vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0, MB_TAG_DENSE);
CHECK_ERR(rval);
rval = mb.tag_get_handle(GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, gid_tag, MB_TAG_DENSE);
https://bitbucket.org/fathomteam/moab/commits/4e004a4fee65/
Changeset: 4e004a4fee65
Branch: None
User: makeclean
Date: 2014-06-06 21:17:11
Summary: propagated changes through to allow prop functions to parse arbitrary chars
Affected #: 1 file
diff --git a/tools/dagmc/DagMC.cpp b/tools/dagmc/DagMC.cpp
index 6e2260a..928a3ea 100755
--- a/tools/dagmc/DagMC.cpp
+++ b/tools/dagmc/DagMC.cpp
@@ -1601,7 +1601,7 @@ ErrorCode DagMC::get_group_name( EntityHandle group_set, std::string& name )
return MB_SUCCESS;
}
-ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
+ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result, const char *delimiters )
{
ErrorCode rval;
std::string group_name;
@@ -1609,7 +1609,7 @@ ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
if( rval != MB_SUCCESS ) return rval;
std::vector< std::string > group_tokens;
- tokenize( group_name, group_tokens, "_" );
+ tokenize( group_name, group_tokens, delimiters );
// iterate over all the keyword positions
// keywords are even indices, their values (optional) are odd indices
@@ -1623,7 +1623,7 @@ ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
return MB_SUCCESS;
}
-ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list )
+ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list, const char *delimiters )
{
ErrorCode rval;
std::set< std::string > keywords;
@@ -1631,7 +1631,7 @@ ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list
grp != group_handles().end(); ++grp )
{
std::map< std::string, std::string > properties;
- rval = parse_group_name( *grp, properties );
+ rval = parse_group_name( *grp, properties, delimiters );
if( rval == MB_TAG_NOT_FOUND ) continue;
else if( rval != MB_SUCCESS ) return rval;
@@ -1698,6 +1698,7 @@ ErrorCode DagMC::unpack_packed_string( Tag tag, EntityHandle eh,
}
ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
+ const char *delimiters,
const std::map<std::string, std::string>& keyword_synonyms )
{
ErrorCode rval;
@@ -1739,7 +1740,7 @@ ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
{
prop_map properties;
- rval = parse_group_name( *grp, properties );
+ rval = parse_group_name( *grp, properties, delimiters );
if( rval == MB_TAG_NOT_FOUND ) continue;
else if( rval != MB_SUCCESS ) return rval;
https://bitbucket.org/fathomteam/moab/commits/628b855fa511/
Changeset: 628b855fa511
Branch: None
User: makeclean
Date: 2014-06-06 21:17:40
Summary: propagated changes to prototypes regarding parsing of arbitrary chars
Affected #: 1 file
diff --git a/tools/dagmc/DagMC.hpp b/tools/dagmc/DagMC.hpp
index fe39082..4e109c3 100755
--- a/tools/dagmc/DagMC.hpp
+++ b/tools/dagmc/DagMC.hpp
@@ -377,13 +377,15 @@ public:
* @param keywords_out The result list of keywords. This list could be
* validly passed to parse_properties().
*/
- ErrorCode detect_available_props( std::vector<std::string>& keywords_out );
+ ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters );
/** Parse properties from group names per metadata syntax standard
*
* @param keywords A list of keywords to parse. These are considered the canonical
* names of the properties, and constitute the valid inputs to
* has_prop() and prop_value().
+ * @param delimiters An array of characters the routine will use to split the groupname
+ * into properties.
* @param synonyms An optional mapping of synonym keywords to canonical keywords.
* This allows more than one group name keyword to take on the same
* meaning
@@ -392,6 +394,7 @@ public:
* group named "graveyard".
*/
ErrorCode parse_properties( const std::vector<std::string>& keywords,
+ const char* delimiters,
const std::map<std::string,std::string>& synonyms = no_synonyms );
/** Get the value of a property on a volume or surface
@@ -471,7 +474,7 @@ private:
/** Store the name of a group in a string */
ErrorCode get_group_name( EntityHandle group_set, std::string& name );
/** Parse a group name into a set of key:value pairs */
- ErrorCode parse_group_name( EntityHandle group_set, prop_map& result );
+ ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters);
/** Add a string value to a property tag for a given entity */
ErrorCode append_packed_string( Tag, EntityHandle, std::string& );
/** Convert a property tag's value on a handle to a list of strings */
https://bitbucket.org/fathomteam/moab/commits/f9ccf95dd9ff/
Changeset: f9ccf95dd9ff
Branch: None
User: makeclean
Date: 2014-06-06 21:18:08
Summary: set the standard characters used in old dagmc tagging
Affected #: 1 file
diff --git a/tools/dagmc/dagmc_preproc.cpp b/tools/dagmc/dagmc_preproc.cpp
index 98b4c63..7ecb281 100644
--- a/tools/dagmc/dagmc_preproc.cpp
+++ b/tools/dagmc/dagmc_preproc.cpp
@@ -454,9 +454,10 @@ int main( int argc, char* argv[] ){
CHECKERR( *dag, ret );
std::vector< std::string > keywords;
- ret = dag->detect_available_props( keywords );
+ char *delimiters = "_.";
+ ret = dag->detect_available_props( keywords, delimiters );
CHECKERR( *dag, ret );
- ret = dag->parse_properties( keywords );
+ ret = dag->parse_properties( keywords, delimiters );
CHECKERR( *dag, ret );
if( verbose ){
https://bitbucket.org/fathomteam/moab/commits/0e12c9f6b459/
Changeset: 0e12c9f6b459
Branch: None
User: makeclean
Date: 2014-06-11 02:47:27
Summary: updated to allow default args to avoid upstream changes
Affected #: 1 file
diff --git a/tools/dagmc/DagMC.hpp b/tools/dagmc/DagMC.hpp
index 4e109c3..b7e6587 100755
--- a/tools/dagmc/DagMC.hpp
+++ b/tools/dagmc/DagMC.hpp
@@ -377,7 +377,7 @@ public:
* @param keywords_out The result list of keywords. This list could be
* validly passed to parse_properties().
*/
- ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters );
+ ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters = '_' );
/** Parse properties from group names per metadata syntax standard
*
@@ -394,8 +394,8 @@ public:
* group named "graveyard".
*/
ErrorCode parse_properties( const std::vector<std::string>& keywords,
- const char* delimiters,
- const std::map<std::string,std::string>& synonyms = no_synonyms );
+ const std::map<std::string,std::string>& synonyms = no_synonyms,
+ const char* delimiters = '_' );
/** Get the value of a property on a volume or surface
*
@@ -466,7 +466,7 @@ private:
/** tokenize the metadata stored in group names - basically borroed from ReadCGM.cpp */
void tokenize( const std::string& str,
std::vector<std::string>& tokens,
- const char* delimiters ) const;
+ const char* delimiters = '_' ) const;
// a common type within the property and group name functions
typedef std::map<std::string, std::string> prop_map;
@@ -474,7 +474,7 @@ private:
/** Store the name of a group in a string */
ErrorCode get_group_name( EntityHandle group_set, std::string& name );
/** Parse a group name into a set of key:value pairs */
- ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters);
+ ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters = '_');
/** Add a string value to a property tag for a given entity */
ErrorCode append_packed_string( Tag, EntityHandle, std::string& );
/** Convert a property tag's value on a handle to a list of strings */
https://bitbucket.org/fathomteam/moab/commits/8ec683c41aa4/
Changeset: 8ec683c41aa4
Branch: None
User: makeclean
Date: 2014-06-11 02:48:06
Summary: updated to reflect changes in header file
Affected #: 1 file
diff --git a/tools/dagmc/DagMC.cpp b/tools/dagmc/DagMC.cpp
index 928a3ea..6d1785b 100755
--- a/tools/dagmc/DagMC.cpp
+++ b/tools/dagmc/DagMC.cpp
@@ -1698,8 +1698,8 @@ ErrorCode DagMC::unpack_packed_string( Tag tag, EntityHandle eh,
}
ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
- const char *delimiters,
- const std::map<std::string, std::string>& keyword_synonyms )
+ const std::map<std::string, std::string>& keyword_synonyms
+ const char *delimiters)
{
ErrorCode rval;
https://bitbucket.org/fathomteam/moab/commits/c84098a003f1/
Changeset: c84098a003f1
Branch: None
User: makeclean
Date: 2014-06-11 22:11:30
Summary: updated protoptypes accordingly
Affected #: 1 file
diff --git a/tools/dagmc/DagMC.hpp b/tools/dagmc/DagMC.hpp
index b7e6587..6b79f67 100755
--- a/tools/dagmc/DagMC.hpp
+++ b/tools/dagmc/DagMC.hpp
@@ -377,7 +377,7 @@ public:
* @param keywords_out The result list of keywords. This list could be
* validly passed to parse_properties().
*/
- ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters = '_' );
+ ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters = "_" );
/** Parse properties from group names per metadata syntax standard
*
@@ -395,7 +395,7 @@ public:
*/
ErrorCode parse_properties( const std::vector<std::string>& keywords,
const std::map<std::string,std::string>& synonyms = no_synonyms,
- const char* delimiters = '_' );
+ const char* delimiters = "_" );
/** Get the value of a property on a volume or surface
*
@@ -466,7 +466,7 @@ private:
/** tokenize the metadata stored in group names - basically borroed from ReadCGM.cpp */
void tokenize( const std::string& str,
std::vector<std::string>& tokens,
- const char* delimiters = '_' ) const;
+ const char* delimiters = "_" ) const;
// a common type within the property and group name functions
typedef std::map<std::string, std::string> prop_map;
@@ -474,7 +474,7 @@ private:
/** Store the name of a group in a string */
ErrorCode get_group_name( EntityHandle group_set, std::string& name );
/** Parse a group name into a set of key:value pairs */
- ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters = '_');
+ ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters = "_");
/** Add a string value to a property tag for a given entity */
ErrorCode append_packed_string( Tag, EntityHandle, std::string& );
/** Convert a property tag's value on a handle to a list of strings */
https://bitbucket.org/fathomteam/moab/commits/75767cff2612/
Changeset: 75767cff2612
Branch: None
User: makeclean
Date: 2014-06-11 22:11:42
Summary: updated for MCNP5 defaults
Affected #: 1 file
diff --git a/tools/dagmc/dagmc_preproc.cpp b/tools/dagmc/dagmc_preproc.cpp
index 7ecb281..ce21baa 100644
--- a/tools/dagmc/dagmc_preproc.cpp
+++ b/tools/dagmc/dagmc_preproc.cpp
@@ -454,10 +454,9 @@ int main( int argc, char* argv[] ){
CHECKERR( *dag, ret );
std::vector< std::string > keywords;
- char *delimiters = "_.";
- ret = dag->detect_available_props( keywords, delimiters );
+ ret = dag->detect_available_props( keywords);
CHECKERR( *dag, ret );
- ret = dag->parse_properties( keywords, delimiters );
+ ret = dag->parse_properties( keywords );
CHECKERR( *dag, ret );
if( verbose ){
https://bitbucket.org/fathomteam/moab/commits/c8e82b12f526/
Changeset: c8e82b12f526
Branch: None
User: makeclean
Date: 2014-06-11 22:25:55
Summary: updated missing comma
Affected #: 1 file
diff --git a/tools/dagmc/DagMC.cpp b/tools/dagmc/DagMC.cpp
index 6d1785b..151b3f5 100755
--- a/tools/dagmc/DagMC.cpp
+++ b/tools/dagmc/DagMC.cpp
@@ -1698,7 +1698,7 @@ ErrorCode DagMC::unpack_packed_string( Tag tag, EntityHandle eh,
}
ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
- const std::map<std::string, std::string>& keyword_synonyms
+ const std::map<std::string, std::string>& keyword_synonyms,
const char *delimiters)
{
ErrorCode rval;
https://bitbucket.org/fathomteam/moab/commits/34da95db82e9/
Changeset: 34da95db82e9
Branch: master
User: vijaysm
Date: 2014-06-19 20:08:15
Summary: Merged in makeclean/moab/dagmc_parsing (pull request #27)
Allows for arbitrary parsing of group names to get properties
Affected #: 3 files
diff --git a/tools/dagmc/DagMC.cpp b/tools/dagmc/DagMC.cpp
index 6e2260a..151b3f5 100755
--- a/tools/dagmc/DagMC.cpp
+++ b/tools/dagmc/DagMC.cpp
@@ -1601,7 +1601,7 @@ ErrorCode DagMC::get_group_name( EntityHandle group_set, std::string& name )
return MB_SUCCESS;
}
-ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
+ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result, const char *delimiters )
{
ErrorCode rval;
std::string group_name;
@@ -1609,7 +1609,7 @@ ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
if( rval != MB_SUCCESS ) return rval;
std::vector< std::string > group_tokens;
- tokenize( group_name, group_tokens, "_" );
+ tokenize( group_name, group_tokens, delimiters );
// iterate over all the keyword positions
// keywords are even indices, their values (optional) are odd indices
@@ -1623,7 +1623,7 @@ ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
return MB_SUCCESS;
}
-ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list )
+ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list, const char *delimiters )
{
ErrorCode rval;
std::set< std::string > keywords;
@@ -1631,7 +1631,7 @@ ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list
grp != group_handles().end(); ++grp )
{
std::map< std::string, std::string > properties;
- rval = parse_group_name( *grp, properties );
+ rval = parse_group_name( *grp, properties, delimiters );
if( rval == MB_TAG_NOT_FOUND ) continue;
else if( rval != MB_SUCCESS ) return rval;
@@ -1698,7 +1698,8 @@ ErrorCode DagMC::unpack_packed_string( Tag tag, EntityHandle eh,
}
ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
- const std::map<std::string, std::string>& keyword_synonyms )
+ const std::map<std::string, std::string>& keyword_synonyms,
+ const char *delimiters)
{
ErrorCode rval;
@@ -1739,7 +1740,7 @@ ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
{
prop_map properties;
- rval = parse_group_name( *grp, properties );
+ rval = parse_group_name( *grp, properties, delimiters );
if( rval == MB_TAG_NOT_FOUND ) continue;
else if( rval != MB_SUCCESS ) return rval;
diff --git a/tools/dagmc/DagMC.hpp b/tools/dagmc/DagMC.hpp
index fe39082..6b79f67 100755
--- a/tools/dagmc/DagMC.hpp
+++ b/tools/dagmc/DagMC.hpp
@@ -377,13 +377,15 @@ public:
* @param keywords_out The result list of keywords. This list could be
* validly passed to parse_properties().
*/
- ErrorCode detect_available_props( std::vector<std::string>& keywords_out );
+ ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters = "_" );
/** Parse properties from group names per metadata syntax standard
*
* @param keywords A list of keywords to parse. These are considered the canonical
* names of the properties, and constitute the valid inputs to
* has_prop() and prop_value().
+ * @param delimiters An array of characters the routine will use to split the groupname
+ * into properties.
* @param synonyms An optional mapping of synonym keywords to canonical keywords.
* This allows more than one group name keyword to take on the same
* meaning
@@ -392,7 +394,8 @@ public:
* group named "graveyard".
*/
ErrorCode parse_properties( const std::vector<std::string>& keywords,
- const std::map<std::string,std::string>& synonyms = no_synonyms );
+ const std::map<std::string,std::string>& synonyms = no_synonyms,
+ const char* delimiters = "_" );
/** Get the value of a property on a volume or surface
*
@@ -463,7 +466,7 @@ private:
/** tokenize the metadata stored in group names - basically borroed from ReadCGM.cpp */
void tokenize( const std::string& str,
std::vector<std::string>& tokens,
- const char* delimiters ) const;
+ const char* delimiters = "_" ) const;
// a common type within the property and group name functions
typedef std::map<std::string, std::string> prop_map;
@@ -471,7 +474,7 @@ private:
/** Store the name of a group in a string */
ErrorCode get_group_name( EntityHandle group_set, std::string& name );
/** Parse a group name into a set of key:value pairs */
- ErrorCode parse_group_name( EntityHandle group_set, prop_map& result );
+ ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters = "_");
/** Add a string value to a property tag for a given entity */
ErrorCode append_packed_string( Tag, EntityHandle, std::string& );
/** Convert a property tag's value on a handle to a list of strings */
diff --git a/tools/dagmc/dagmc_preproc.cpp b/tools/dagmc/dagmc_preproc.cpp
index 98b4c63..ce21baa 100644
--- a/tools/dagmc/dagmc_preproc.cpp
+++ b/tools/dagmc/dagmc_preproc.cpp
@@ -454,7 +454,7 @@ int main( int argc, char* argv[] ){
CHECKERR( *dag, ret );
std::vector< std::string > keywords;
- ret = dag->detect_available_props( keywords );
+ ret = dag->detect_available_props( keywords);
CHECKERR( *dag, ret );
ret = dag->parse_properties( keywords );
CHECKERR( *dag, ret );
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