Commit ca5a9fa8 authored by Iulian Grindeanu's avatar Iulian Grindeanu Committed by vijaysm
Browse files

Preparation to cleanup interfaces, tests so that merge to MOAB can

happen smoothly.
parent b1d74457
config/ar-lib
*.trs
*~
*.a
aclocal.m4
autom4te.cache/
bin
bin/*
*.ccm
config/config.guess
config/config.sub
config/depcomp
config.h
config.h.in
config/install-sh
config/libtool.m4
config.log
config.lt
config/compile
config/ltmain.sh
config/lt~obsolete.m4
config/ltoptions.m4
config/ltsugar.m4
config/ltversion.m4
config/missing
config.status
config/test-driver
configure
.cproject
*.cub
cubit??.jou
.deps
.dirstamp
doc/config.tex
doc/dev.dox
doc/user/*
doc/user.dox
examples/CrystalRouterExample
examples/DeformMeshRemap
examples/DirectAccessNoHoles
examples/DirectAccessNoHolesF90
examples/DirectAccessWithHoles
examples/ErrorHandlingSimulation
examples/freem.mod
examples/GenLargeMesh
examples/GetEntities
examples/*.h5m
examples/HelloMOAB
examples/HelloParMOAB
examples/itaps/FindConnectF
examples/itaps/ListSetsNTagsCXX
examples/itaps/ListSetsNTagsF90
examples/itaps/TagIterateC
examples/itaps/TagIterateF
examples/LloydRelaxation
examples/LoadPartial
examples/point_in_elem_search
examples/PushParMeshIntoMoabF90
examples/ReadWriteTest
examples/ReduceExchangeTags
examples/SetsNTags
examples/structuredmesh
examples/StructuredMeshSimple
examples/TestErrorHandling
examples/TestErrorHandlingPar
examples/TestExodusII
examples/VisTags
history??.jou
hpctoolkit-*
*.hpcstruct
include
include/*
itaps/iBase_f.h
itaps/igeom/FBiGeom-Defs.inc
itaps/igeom/FBiGeom_protos.h
itaps/igeom/testgeom
itaps/igeom/testSmooth2
itaps/igeom/testSmoothGeom
itaps/imesh/FindAdjacencyF90
itaps/imesh/iMesh-Defs.inc
itaps/imesh/iMesh_extensions_protos.h
itaps/imesh/iMeshP_extensions_protos.h
itaps/imesh/iMeshP_protos.h
itaps/imesh/iMesh_protos.h
itaps/imesh/MOAB_iMesh_extensions_tests
itaps/imesh/MOAB_iMeshP_unit_tests
itaps/imesh/MOAB_iMesh_unit_tests
itaps/imesh/partest
itaps/imesh/ScdMeshF77
itaps/imesh/ScdMeshF90
itaps/imesh/testc_cbind
*.la
*.lai
lib
lib/*
.libs
libtool
*.lo
*.log
makefile
Makefile
*/Makefile
*/**/Makefile
*/**/Makefile.in
*/Makefile.in
Makefile.in
moab.config
MOABConfig.cmake
*.creator*
*.files
*.includes
moab.make
*.o
.project
*.rej
share/*
share/doc/moab
share/man/man1
*.so
src/FCDefs.h
src/io/mhdf/h5minfo
src/io/mhdf/h5mvalidate
src/MBCN_protos.h
src/moab/EntityHandle.hpp
src/MOAB_FCDefs.h
src/moab/stamp-h2
src/moab/stamp-h3
src/moab/Version.h
src/parallel/moab_mpi_config.h
src/parallel/stamp-h4
src/stamp-h5
stamp-h1
test/adaptive_kd_tree_tests
test/adj_moab_test
test/bsp_tree_poly_test
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/dual/dual.vtk
test/elem_eval_test
test/file_options_test
test/*.h5m
test/*.g
test/*.gen
test/geom_util_test
test/gttool_test
test/h5file/dump_sets
test/h5file/h5legacy
test/h5file/h5partial
test/h5file/h5portable
test/h5file/h5regression
test/h5file/h5sets_test
test/h5file/h5test
test/h5file/h5varlen
test/homxform_test
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_facet_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
test/io/readutil_test
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
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
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/imeshp_test
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_adj
test/parallel/parallel_hdf5_test
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/parmerge_test
test/parallel/partcheck
test/parallel/pcomm_serial
test/parallel/pcomm_unit
test/parallel/read_nc_par
test/parallel/scdpart
test/parallel/scdtest
test/parallel/structured3
test/parallel/uber_parallel_test
test/parallel/ucdtrvpart
test/parallel/*.vtk
test/parallel/write_nc_par
test/perf/adj_mem_time
test/perf/adj_time
test/perf/perf
test/perf/perftool
test/perf/point_in_elem
test/perf/runtest
test/perf/seqperf
test/perf/tstt_perf_binding
test/perf/umr_perf
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
test/scd_test_partn
test/seq_man_test
test/spatial_locator_test
test/test_boundbox
test/tag_test
test/test_adj
test/test_determinism
test/test_prog_opt
test/TestRunner.hpp
test/uref_mesh_test
test/var_len_test
test/var_len_test_no_template
test/verdict_test
test/xform_test
tools/dagmc/dagmc_preproc
tools/dagmc/pt_vol_test
tools/dagmc/quads_to_tris
tools/dagmc/ray_fire_test
tools/dagmc/test_geom
tools/dagmc/update_coords
tools/hexmodops
tools/mbconvert
tools/mbmerge
tools/mbcoupler/*.h5m
tools/mbcoupler/*.g
tools/mbcoupler/parcoupler_test
tools/mbcoupler/tests/
tools/mbcslam/advection
tools/mbcslam/arc_intx_tests
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/IntxRllCssphere_test
tools/mbcslam/intx.vtk
tools/mbcslam/lagr.h5m
tools/mbcslam/lagrIni.h5m
tools/mbcslam/linear_advection
tools/mbcslam/linear_remap
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
tools/mbpart
tools/mbquality
tools/mbsize
tools/mbskin
tools/mbsurfplot
tools/mbtagprop
tools/mbzoltan/Config.moab
tools/refiner/test_mesh_refiner
tools/spheredecomp
tools/vtkMOABReader/CMakeLists.txt
tools/vtkMOABReaderNew/CMakeLists.txt
tools/vtkMOABReaderNew/CMakeCache.txt
tools/vtkMOABReaderNew/CMakeFiles/*
tools/vtkMOABReaderNew/cmake_install.cmake
tools/vtkMOABReaderNew/vtkMoabReaderPlugin.qrc
tools/vtkMOABReaderNew/vtkMoabReaderPluginInit.cxx
tools/vtkMOABReaderNew/vtkMoabReaderPlugin_Plugin.cxx
tools/vtkMOABReaderNew/vtkMoabReaderPlugin_Plugin.h
tools/vtkMOABReaderNew/vtkSMvtkMoabReaderPluginInstantiator.cxx
tools/vtkMOABReaderNew/vtkSMvtkMoabReaderPluginInstantiator.h
Steps to test driver.c interface:
1) compile imoab.o
cd src
make imoab.o
2) compile driver
cd ../test
make driver
// test driver with ./driver p8ex1.h5m
// test driver with mpiexec -np 4 ./driver p8ex1.h5m
Notes about this example file:
does not have overlapping neumann sets! (material sets are of course, non overlapping)
I added a dirichlet set, manually, value 3; about 15 vertices are part of it (top)
it contains 4 material sets, and 8 parts; after ghosting, more material sets will be visible
on each task (the same it is maybe true for neumann sets)
this file is copied from https://svn.mcs.anl.gov/repos/SHARP/trunk, modules/unic/short_term_MOAB
It was checked in by Vijay, to test changes to moab parallel reader in 2012!!
This diff is collapsed.
......@@ -71,6 +71,7 @@ libMOAB_la_SOURCES = \
HalfFacetRep.cpp \
HigherOrderFactory.cpp \
HomXform.cpp \
iMOAB.cpp \
Internals.hpp \
LloydSmoother.cpp \
MBCNArrays.hpp \
......@@ -179,6 +180,8 @@ nobase_libMOAB_la_include_HEADERS = \
moab/Forward.hpp \
moab/GeomUtil.hpp \
moab/Interface.hpp \
moab/iMOAB.h \
moab/imoab_protos.h \
moab/LloydSmoother.hpp \
moab/point_locater/tree/common_tree.hpp \
moab/point_locater/tree/element_tree.hpp \
......
......@@ -2,24 +2,30 @@
*/
#include "moab/Core.hpp"
#include "moab/MOABConfig.h"
using namespace moab;
#include "mpi.h"
#ifdef MOAB_HAVE_MPI
# include "moab_mpi.h"
# include "moab/ParallelComm.hpp"
#endif
#include <assert.h>
#include "moab/iMOAB.h"
/*
this mhdf.h is not part of moab installation, but it is part of moab library
copy it in this folder (imoab/src/mhdf) temporarily; after imoab is part of moab, it is not neded
*/
#include "moab/mhdf.h"
#include <stdio.h>
/*
this is needed so far because of direct access to hdf5/mhdf
*/
#ifdef MOAB_HAVE_HDF5
#include "mhdf.h"
#include <H5Tpublic.h>
#endif
#include <stdio.h>
#include <iostream>
#include "moab/ParallelComm.hpp"
#include "MBTagConventions.hpp"
#include "moab/MeshTopoUtil.hpp"
#include <sstream>
......@@ -67,7 +73,11 @@ iMOAB_String * iArgv;
int unused_pid =0;
// std::vector<EntityHandle> app_FileSets; // in order of creation
std::map<std::string, int> appIdMap; // from app string (uppercase) to app id
#ifdef MOAB_HAVE_MPI
std::vector<ParallelComm*> pcomms; // created in order of applications, one moab::ParallelComm for each
#endif
std::vector<appData> appDatas; // the same order as pcomms
ErrCode iMOAB_Initialize( int argc, iMOAB_String* argv )
......@@ -123,7 +133,11 @@ ErrCode iMOAB_Finalize()
return MB_SUCCESS;
}
ErrCode iMOAB_RegisterApplication( iMOAB_String app_name, MPI_Comm* comm, iMOAB_AppID pid )
ErrCode iMOAB_RegisterApplication( iMOAB_String app_name,
#ifdef MOAB_HAVE_MPI
MPI_Comm* comm,
#endif
iMOAB_AppID pid )
{
// will create a parallel comm for this application too, so there will be a
// mapping from *pid to file set and to parallel comm instances
......@@ -136,6 +150,7 @@ ErrCode iMOAB_RegisterApplication( iMOAB_String app_name, MPI_Comm* comm, iMOAB_
*pid = unused_pid++;
appIdMap[name] = *pid;
// now create ParallelComm and a file set for this application
#ifdef MOAB_HAVE_MPI
ParallelComm * pco = new ParallelComm(MBI, *comm);
#if 1
......@@ -143,6 +158,7 @@ ErrCode iMOAB_RegisterApplication( iMOAB_String app_name, MPI_Comm* comm, iMOAB_
assert(index==*pid);
#endif
pcomms.push_back(pco);
#endif
// create now the file set that will be used for loading the model in
EntityHandle file_set;
......@@ -165,6 +181,7 @@ ErrCode iMOAB_RegisterFortranApplication( iMOAB_String app_name, int* comm, iMOA
}
*pid = unused_pid++;
appIdMap[name] = *pid;
#ifdef MOAB_HAVE_MPI
// now create ParallelComm and a file set for this application
// convert from fortran communicator to a c communicator
// see transfer of handles
......@@ -173,10 +190,11 @@ ErrCode iMOAB_RegisterFortranApplication( iMOAB_String app_name, int* comm, iMOA
ParallelComm * pco = new ParallelComm(MBI, ccomm);
#if 1
int index = pco->get_id(); // t could be useful to get app id from pcomm instance ...
int index = pco->get_id(); // it could be useful to get app id from pcomm instance ...
assert(index==*pid);
#endif
pcomms.push_back(pco);
#endif
// create now the file set that will be used for loading the model in
EntityHandle file_set;
......@@ -194,9 +212,7 @@ ErrCode iMOAB_DeregisterApplication( iMOAB_AppID pid )
// the file set , parallel comm are all in vectors indexed by *pid
// assume we did not delete anything yet
// *pid will not be reused if we register another application
ParallelComm * pco = pcomms[*pid];
// we could get the pco also with
// ParallelComm * pcomm = ParallelComm::get_pcomm(MBI, *pid);
EntityHandle fileSet = appDatas[*pid].file_set;
// get all entities part of the file set
Range fileents;
......@@ -209,7 +225,13 @@ ErrCode iMOAB_DeregisterApplication( iMOAB_AppID pid )
rval = MBI->get_entities_by_type(fileSet, MBENTITYSET, fileents); // append all mesh sets
if (MB_SUCCESS != rval )
return 1;
#ifdef MOAB_HAVE_MPI
ParallelComm * pco = pcomms[*pid];
// we could get the pco also with
// ParallelComm * pcomm = ParallelComm::get_pcomm(MBI, *pid);
delete pco;
#endif
rval = MBI->delete_entities(fileents);
if (MB_SUCCESS != rval )
......@@ -220,6 +242,7 @@ ErrCode iMOAB_DeregisterApplication( iMOAB_AppID pid )
ErrCode iMOAB_ReadHeaderInfo ( iMOAB_String filename, int* num_global_vertices, int* num_global_elements, int* num_dimension, int* num_parts, int filename_length )
{
#ifdef MOAB_HAVE_HDF5
std::string filen(filename);
if (filename_length< (int)filen.length())
{
......@@ -317,6 +340,11 @@ ErrCode iMOAB_ReadHeaderInfo ( iMOAB_String filename, int* num_global_vertices,
mhdf_closeFile( file, &status );
free( data );
#else
std::cout << " cannot retrieve header info except for h5m file \n";
#endif
return 0;
}
......@@ -325,6 +353,7 @@ ErrCode iMOAB_LoadMesh( iMOAB_AppID pid, iMOAB_String filename, iMOAB_String rea
// make sure we use the file set and pcomm associated with the *pid
std::ostringstream newopts;
#ifdef MOAB_HAVE_MPI
newopts << read_options;
newopts << ";PARALLEL_COMM="<<*pid;
if (*num_ghost_layers>=1)
......@@ -333,11 +362,17 @@ ErrCode iMOAB_LoadMesh( iMOAB_AppID pid, iMOAB_String filename, iMOAB_String rea
// because the addl ents can be edges, faces that are part of the neumann sets
newopts << ";PARALLEL_GHOSTS=3.0."<<*num_ghost_layers<<".3";
}
#endif
ErrorCode rval = MBI->load_file(filename, &appDatas[*pid].file_set, newopts.str().c_str());
if (MB_SUCCESS!=rval)
return 1;
int rank = pcomms[*pid]->rank();
int nprocs=pcomms[*pid]->size();
int rank = 0;
int nprocs=1;
#ifdef MOAB_HAVE_MPI
rank = pcomms[*pid]->rank();
nprocs = pcomms[*pid]->size();
#endif
#if 1
// some debugging stuff
......@@ -400,6 +435,8 @@ ErrCode iMOAB_GetMeshInfo( iMOAB_AppID pid, int* num_visible_vertices, int* num_
}
num_visible_elements[2] = (int) data.primary_elems.size();
// separate ghost and local/owned primary elements
#ifdef MOAB_HAVE_MPI
ParallelComm * pco = pcomms[*pid];
// filter ghost vertices, from local
......@@ -419,7 +456,15 @@ ErrCode iMOAB_GetMeshInfo( iMOAB_AppID pid, int* num_visible_vertices, int* num_
// get all blocks, BCs, etc
num_visible_elements[0] = (int)data.owned_elems.size();
num_visible_elements[1] = (int)data.ghost_elems.size();
#else
num_visible_vertices[0] = (int)data.all_verts.size();
data.local_verts = data.all_verts;
num_visible_vertices[1] = 0; /* no ghosts */
data.owned_elems = data.primary_elems;
num_visible_elements[0] = (int)data.owned_elems.size();
num_visible_elements[1] = (int)data.ghost_elems.size();
#endif
rval = MBI->get_entities_by_type_and_tag(fileSet, MBENTITYSET, &(gtags[0]), 0, 1, data.mat_sets , Interface::UNION);
if (MB_SUCCESS!=rval)
return 1;
......@@ -484,6 +529,7 @@ ErrCode iMOAB_GetVertexID( iMOAB_AppID pid, int * vertices_length, iMOAB_GlobalI
ErrCode iMOAB_GetVertexOwnership( iMOAB_AppID pid, int *vertices_length, int* visible_global_rank_ID )
{
Range & verts = appDatas[*pid].all_verts;
#ifdef MOAB_HAVE_MPI
ParallelComm * pco = pcomms[*pid];
int i=0;
for (Range::iterator vit=verts.begin(); vit!=verts.end(); vit++, i++)
......@@ -494,7 +540,12 @@ ErrCode iMOAB_GetVertexOwnership( iMOAB_AppID pid, int *vertices_length, int* vi
}
if (i!=*vertices_length)
return 1; // warning array allocation problem
#else
/* everything owned by proc 0 */
int i=0;
for (Range::iterator vit=verts.begin(); vit!=verts.end(); vit++, i++)
visible_global_rank_ID[i] = 0;
#endif
return 0;
}
......@@ -564,7 +615,10 @@ ErrCode iMOAB_GetVisibleElementsInfo(iMOAB_AppID pid, int* num_visible_elements,
iMOAB_GlobalID * element_global_IDs, int * ranks, iMOAB_GlobalID * block_IDs)
{
appData & data = appDatas[*pid];
#ifdef MOAB_HAVE_MPI
ParallelComm * pco = pcomms[*pid];
#endif
ErrorCode rval = MBI-> tag_get_data(gtags[3], data.primary_elems, element_global_IDs);
if (MB_SUCCESS!=rval)
return 1;
......@@ -572,9 +626,14 @@ ErrCode iMOAB_GetVisibleElementsInfo(iMOAB_AppID pid, int* num_visible_elements,
int i=0;
for (Range::iterator eit=data.primary_elems.begin(); eit!=data.primary_elems.end(); ++eit, ++i)
{
#ifdef MOAB_HAVE_MPI
rval = pco->get_owner(*eit, ranks[i]);
if (MB_SUCCESS!=rval)
return 1;
#else
/* everything owned by task 0 */
ranks[i] = 0;
#endif
}
for (Range::iterator mit=data.mat_sets.begin(); mit!=data.mat_sets.end(); ++mit)
{
......@@ -670,7 +729,6 @@ ErrCode iMOAB_GetElementConnectivity(iMOAB_AppID pid, iMOAB_LocalID * elem_index
ErrCode iMOAB_GetElementOwnership(iMOAB_AppID pid, iMOAB_GlobalID * global_block_ID, int * num_elements_in_block, int* element_ownership)
{
std::map<int, int> & matMap = appDatas[*pid].matIndex;
ParallelComm * pco = pcomms[*pid];
std::map<int,int>::iterator it = matMap.find(*global_block_ID);
if (it==matMap.end())
......@@ -686,11 +744,18 @@ ErrCode iMOAB_GetElementOwnership(iMOAB_AppID pid, iMOAB_GlobalID * global_block
if (*num_elements_in_block!=(int)elems.size())
return 1; // bad memory allocation
int i=0;
#ifdef MOAB_HAVE_MPI
ParallelComm * pco = pcomms[*pid];
#endif
for (Range::iterator vit=elems.begin(); vit!=elems.end(); vit++, i++)
{
#ifdef MOAB_HAVE_MPI
rval = pco-> get_owner(*vit, element_ownership[i]);
if (MB_SUCCESS!=rval)
return 1;
#else
element_ownership[i] = 0; /* owned by 0 */
#endif
}
return 0;
}
......@@ -1069,6 +1134,7 @@ ErrCode iMOAB_GetDoubleTagStorage(iMOAB_AppID pid, iMOAB_String tag_storage_name
ErrCode iMOAB_SynchronizeTags(iMOAB_AppID pid, int * num_tag, int * tag_indices, int * ent_type)
{
#ifdef MOAB_HAVE_MPI
appData & data = appDatas[*pid];
Range ent_exchange;
std::vector<Tag> tags;
......@@ -1090,7 +1156,8 @@ ErrCode iMOAB_SynchronizeTags(iMOAB_AppID pid, int * num_tag, int * tag_indices,
ErrorCode rval = pco->exchange_tags(tags, tags, ent_exchange);
if (rval!=MB_SUCCESS)
return 1;
#endif
/* do nothing if serial */
return 0;
}
......
# MOAB_DIR points to top-level install dir, below which MOAB's lib/ and include/ are located
MOAB_BUILD_DIR := /homes/iulian/source/MOAB14
MOAB_DIR := /usr/software/moab/dev/feature_check
ifneq ($(wildcard ${MOAB_DIR}/lib/moab.make),)
include ${MOAB_DIR}/lib/moab.make
include ${MOAB_DIR}/lib/iMesh-Defs.inc
else
include ${MOAB_BUILD_DIR}/moab.make
include ${MOAB_BUILD_DIR}/itaps/imes