moab-dev
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
August 2008
- 10 participants
- 24 discussions
Author: kraftche
Date: 2008-08-29 11:51:46 -0500 (Fri, 29 Aug 2008)
New Revision: 2052
Modified:
MOAB/trunk/configure.in
MOAB/trunk/tools/mbzoltan/Makefile.am
Log:
Overhaul Zoltan configuration/detection:
- require no options if Zoltan and Parmetis are in default search path
- require --with-zoltan-arch only when necessary to disambiguate between
mulitple Obj_$ARCH directories.
- detect whether or not Zoltan requires Parmetis (don't require Parmetis
if Zoltan doesn't.)
This problably needs more work. Zoltan can also optionally depend on
other libraries (e.g. PaToH and Nemesis) that we don't handle.
Modified: MOAB/trunk/configure.in
===================================================================
--- MOAB/trunk/configure.in 2008-08-29 03:21:07 UTC (rev 2051)
+++ MOAB/trunk/configure.in 2008-08-29 16:51:46 UTC (rev 2052)
@@ -285,53 +285,99 @@
# Zoltan
################################################################################
if test $ENABLE_mbzoltan = yes; then
- AC_ARG_WITH([zoltan],
- [AC_HELP_STRING([--with-zoltan=DIR],[Specify directory containing Zoltan])],
- [ZOLTAN_DIR="$withval"
- DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-zoltan=\"${withval}\""
- ],[ZOLTAN_DIR=unknown])
- AC_ARG_WITH([zoltan-arch],
- [AC_HELP_STRING([--with-zoltan-arch=OS],[Specify zoltan architecture])],
- [ZOLTAN_ARCH="$withval"],[ZOLTAN_ARCH=unknown])
- case "x$ZOLTAN_DIR" in
- xno|x)
- ZOLTAN_MISSING=yes
- ;;
- xyes)
- AC_MSG_ERROR([--enable-mbzoltan requires an argument])
- ;;
- esac
if test "x$WITH_MPI" = "xno"; then
- AC_MSG_ERROR([--enable-mbzoltan requires --with-mpi too!])
+ AC_MSG_ERROR([--enable-mbzoltan requires MPI, try specifying --with-mpi])
fi
- if ! test -d "$ZOLTAN_DIR"; then
- AC_MSG_WARN([$ZOLTAN_DIR : not a directory.])
- fi
- AC_CHECK_FILES([${ZOLTAN_DIR}/include/zoltan.h],
- [], [AC_MSG_WARN([$ZOLTAN_DIR : not a valid zoltan source]); ZOLTAN_MISSING=yes])
+
- ZOLTAN_INCLUDES="-I${ZOLTAN_DIR}/include"
- ZOLTAN_LIBS="-L${ZOLTAN_DIR}/Obj_${ZOLTAN_ARCH} -lzoltan"
+ ZOLTAN_LIB_FLAGS=
+ ZOLTAN_INC_FLAGS=
+ ZOLTAN_LIBS=
+ ZOLTAN_ARCH=
+ ZOLTAN_DIR=
- AC_ARG_WITH(parmetis,
- [AC_HELP_STRING([--with-parmetis=DIR], [Specify directory containing parmetis library])],
- [PARMETIS_DIR=$withval], [PARMETIS_DIR=])
- case "x$PARMETIS_DIR" in
- xno|x)
- PARMETIS_MISSING=yes
- ;;
- xyes)
- AC_MSG_ERROR([--with-parmetis requires an argument])
- ;;
- esac
- if test -d "$PARMETIS_DIR"; then
- ZOLTAN_LIBS="$ZOLTAN_LIBS -L$PARMETIS_DIR -lparmetis -lmetis"
- fi
+ AC_ARG_WITH( [zoltan],
+ [AC_HELP_STRING([--with-zoltan=DIR],[Specify Zoltan build directory])],
+ [if test "xyes" = "$withval"; then
+ AC_MSG_WARN([Ingoring --with-zoltan flag w/out value])
+ elif test -d $withval/$include; then
+ ZOLTAN_INC_FLAGS="$ZOLTAN_INC_FLAGS -I$withval/include"
+ ZOLTAN_DIR="$withval"
+ else
+ AC_MSG_ERROR("$withval/include : not a directory")
+ fi
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-zoltan=\"${withval}\""
+ ])
- AC_SUBST(ZOLTAN_DIR)
+ AC_ARG_WITH([zoltan-arch],
+ [AC_HELP_STRING([--with-zoltan-arch=OS],[Specify zoltan architecture])],
+ [if test "xyes" = "x$withval"; then
+ AC_MSG_ERROR([--with-zoltan-arch flag requires a value])
+ elif test "x" = "x$ZOLTAN_DIR"; then
+ AC_MSG_WARN([Ingoring --with-zoltan-arch without --with-zoltan])
+ elif test -d "$ZOLTAN_DIR/Obj_$withval"; then
+ ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$ZOLTAN_DIR/Obj_$withval"
+ else
+ AC_MSG_ERROR("$ZOLTAN_DIR/Obj_$withval : not a directory")
+ fi],
+ [if test "x" != "x$ZOLTAN_DIR"; then
+ AC_MSG_WARN([Expect --with-zoltan-arch with --with-zoltan])
+ if test -d $ZOLTAN_DIR/lib; then
+ AC_MSG_WARN("Guessing '$ZOLTAN_DIR/lib'")
+ ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$ZOLTAN_DIR/lib"
+ else
+ # if only one Obj_$ARCH dir, then us it
+ found=no
+ for dir in $ZOLTAN_DIR/Obj_*; do
+ if test -d $dir; then
+ if test "xyes" = "x$found"; then
+ AC_MSG_ERROR("Multiple Zoltan Obj_$ARCH dirs. --with-zoltan-arch required.")
+ fi
+ ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$dir"
+ found=yes
+ fi
+ done
+ if test "xno" = "x$found"; then
+ AC_MSG_ERROR('No Zoltan Obj_$ARCH dir found. --with-zoltan-arch required.')
+ fi
+ fi
+ fi
+ ])
+
+ AC_ARG_WITH([parmetis],
+ [AC_HELP_STRING([--with-parmetis=DIR],
+ [Directory containing Parmetis library for Zoltan])],
+ [if test "xyes" = "$withval"; then
+ AC_MSG_WARN([Ingoring --with-parmetis flag w/out value])
+ elif test -d "$withval"; then
+ ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$withval"
+ else
+ AC_MSG_ERROR("$withval: not a directory")
+ fi]
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-parmetis=\"${withval}\""
+ )
+
+ old_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ZOLTAN_INC_FLAGS -DMPICH_IGNORE_CXX_SEEK"
+ AC_LANG_PUSH([C++])
+ AC_CHECK_HEADER([zoltan_cpp.h],[],[AC_MSG_ERROR("mbzoltan requires zoltan")])
+ AC_LANG_POP([C++])
+ CPPFLAGS="$old_CPPFLAGS"
+
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $ZOLTAN_LIB_FLAGS"
+ AC_CHECK_LIB([zoltan],[Zoltan_LB_Partition],[ZOLTAN_LIBS='-lzoltan'],
+ [unset ac_cv_lib_zoltan_Zoltan_LB_Partition
+ AC_CHECK_LIB([zoltan],[Zoltan_LB_Partition],
+ [ZOLTAN_LIBS="-lzoltan -lparmetis -lmetis"],
+ [AC_MSG_ERROR("mbzoltan requires zoltan")],
+ [-lparmetis -lmetis])])
+ LDFLAGS="$old_LDFLAGS"
+
+
AC_SUBST(ZOLTAN_LIBS)
- AC_SUBST(ZOLTAN_INCLUDES)
- AC_SUBST(ZOLTAN_ARCH)
+ AC_SUBST(ZOLTAN_LIB_FLAGS)
+ AC_SUBST(ZOLTAN_INC_FLAGS)
fi
################################################################################
Modified: MOAB/trunk/tools/mbzoltan/Makefile.am
===================================================================
--- MOAB/trunk/tools/mbzoltan/Makefile.am 2008-08-29 03:21:07 UTC (rev 2051)
+++ MOAB/trunk/tools/mbzoltan/Makefile.am 2008-08-29 16:51:46 UTC (rev 2052)
@@ -1,9 +1,9 @@
AUTOMAKE_OPTIONS = foreign
DEFS = $(DEFINES) -DIS_BUILDING_MB
-INCLUDES += -I$(top_srcdir) -I$(top_builddir) $(ZOLTAN_INCLUDES)
+INCLUDES += -I$(top_srcdir) -I$(top_builddir) $(ZOLTAN_INC_FLAGS)
bin_PROGRAMS = mbzoltan
mbzoltan_SOURCES = MBZoltan.cpp MBZoltan.hpp main.cpp
-LDADD = $(top_builddir)/libMOAB.la $(ZOLTAN_LIBS)
+mbzoltan_LDADD = $(top_builddir)/libMOAB.la $(ZOLTAN_LIB_FLAGS) $(ZOLTAN_LIBS)
mbzoltan_DEPENDENCIES = $(top_builddir)/libMOAB.la
2
1
During the install phase of moab I have a problem with
-L/usr/local/zoltan/Obj_unknown
Why is Obj_unknown appearing and how do I change it?
See below for full command. The Zoltan library has no "install"
mechanism therefore I have it installed on my system in
/usr/local/zoltan
which has /include /bin /lib subdirectories. During the moab
.configure step, zoltan.h is correctly found in
/usr/local/zoltan/include. The full .configure I am using for moab is:
./configure --prefix=$HOME/projects/scidac/itaps/moab-usr
--enable-doxygen --with-mpi=/usr/local/ompi --with-hdf5=/usr/local/hdf5
--with-zoltan=/usr/local/zoltan --with-parmetis=/usr/local/parmetis
--enable-mbzoltan
Any help appreciated. Thanks,
--
Valmor
/usr/local/ompi_gnu/bin/mpicxx -Wall -pipe -O2 -DNDEBUG -o mbzoltan
MBZoltan.o main.o -L/usr/local/hdf5/lib ../../.libs/libMOAB.a
/usr/lib/libnetcdf_c++.so /usr/lib/libnetcdf.so
/usr/local/packages/hdf5-1.8.1_gcc-4.1.2/lib/libhdf5.a -L//lib -lsz -lz
/usr/local/packages/openmpi-1.2.6_gcc-4.1.2/lib/libmpi_cxx.so
/usr/local/packages/openmpi-1.2.6_gcc-4.1.2/lib/libmpi.so
/usr/local/packages/openmpi-1.2.6_gcc-4.1.2/lib/libopen-rte.so
/usr/local/packages/openmpi-1.2.6_gcc-4.1.2/lib/libopen-pal.so
-L/usr/local/zoltan/Obj_unknown -lzoltan -L/usr/local/parmetis
-lparmetis -lmetis -lm -Wl,--rpath
-Wl,/usr/local/packages/openmpi-1.2.6_gcc-4.1.2/lib -Wl,--rpath
-Wl,/usr/local/packages/openmpi-1.2.6_gcc-4.1.2/lib
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/bin/l
d: cannot find -lzoltan
---------------------------------
Valmor de Almeida, Ph.D.
Oak Ridge National Laboratory
1 Bethel Valley Road
PO Box 2008
Oak Ridge TN 37831-6181
url: dealmeidav.ornl.gov
tel: 865-241-2906
fax: 865-241-4829
---------------------------------
3
5
Author: dcthomp
Date: 2008-08-28 22:21:07 -0500 (Thu, 28 Aug 2008)
New Revision: 2051
Modified:
MOAB/trunk/refiner/MBMeshOutputFunctor.cpp
MOAB/trunk/refiner/MBMeshOutputFunctor.hpp
MOAB/trunk/refiner/MBRefinerTagManager.cpp
MOAB/trunk/refiner/MBSplitVertices.cpp
MOAB/trunk/refiner/MBSplitVertices.hpp
Log:
BUG: Global IDs were being assigned to elements out-of-order across
processes because their corner vertex IDs aren't assigned at
the time they were being sorted. Delay sorting until later.
Modified: MOAB/trunk/refiner/MBMeshOutputFunctor.cpp
===================================================================
--- MOAB/trunk/refiner/MBMeshOutputFunctor.cpp 2008-08-28 19:13:05 UTC (rev 2050)
+++ MOAB/trunk/refiner/MBMeshOutputFunctor.cpp 2008-08-29 03:21:07 UTC (rev 2051)
@@ -17,6 +17,10 @@
this->tag_manager = tag_mgr;
this->destination_set = 0; // don't place output entities in a set by default.
+ // When the input mesh and the output mesh are different, this map serves
+ // as a dictionary from input vertices to output vertices.
+ this->vertex_map = new MBSplitVertices<1>( this->tag_manager );
+
// Hold information about newly-created vertices on subdivided edges and faces.
this->split_vertices.resize( 4 );
this->split_vertices[0] = 0; // Vertices (0-faces) cannot be split
@@ -27,15 +31,16 @@
// Hold information about newly-created mesh entities (other than split vertices)
// This is necessary in order for global IDs to be assigned consistently across processes.
this->new_entities.resize( 5 );
- this->new_entities[0] = new MBSplitVertices<0>( this->tag_manager );
- this->new_entities[1] = new MBSplitVertices<1>( this->tag_manager );
- this->new_entities[2] = new MBSplitVertices<2>( this->tag_manager );
- this->new_entities[3] = new MBSplitVertices<3>( this->tag_manager );
- this->new_entities[4] = new MBSplitVertices<4>( this->tag_manager );
+ this->new_entities[0] = new MBEntitySource( 1, this->tag_manager );
+ this->new_entities[1] = new MBEntitySource( 2, this->tag_manager );
+ this->new_entities[2] = new MBEntitySource( 3, this->tag_manager );
+ this->new_entities[3] = new MBEntitySource( 4, this->tag_manager );
+ this->new_entities[4] = new MBEntitySource( 5, this->tag_manager );
}
MBMeshOutputFunctor::~MBMeshOutputFunctor()
{
+ delete this->vertex_map;
for ( int i = 1; i < 4; ++ i )
delete this->split_vertices[i];
for ( int i = 0; i < 5; ++ i )
@@ -156,10 +161,11 @@
{
(*vit)->assign_global_ids( gids );
}
- for ( vit = this->new_entities.begin(); vit != this->new_entities.end(); ++ vit )
+ std::vector<MBEntitySource*>::iterator sit;
+ for ( sit = this->new_entities.begin(); sit != this->new_entities.end(); ++ sit )
{
- if ( *vit )
- (*vit)->assign_global_ids( gids );
+ if ( *sit )
+ (*sit)->assign_global_ids( gids );
}
}
@@ -190,7 +196,7 @@
return vhash;
}
MBEntityHandle vertex_handle;
- bool newly_created = this->new_entities[1]->find_or_create(
+ bool newly_created = this->vertex_map->find_or_create(
&vhash, vcoords, vertex_handle, this->proc_partition_counts, false );
if ( newly_created )
{
@@ -206,6 +212,7 @@
std::cerr << "Could not insert vertex into new mesh!\n";
}
this->print_vert_crud( vertex_handle, 1, &vhash, vcoords, vtags );
+ std::cout << "\nMap vert: " << vhash << " to: " << vertex_handle << "\n";
return vertex_handle;
}
Modified: MOAB/trunk/refiner/MBMeshOutputFunctor.hpp
===================================================================
--- MOAB/trunk/refiner/MBMeshOutputFunctor.hpp 2008-08-28 19:13:05 UTC (rev 2050)
+++ MOAB/trunk/refiner/MBMeshOutputFunctor.hpp 2008-08-29 03:21:07 UTC (rev 2051)
@@ -38,6 +38,7 @@
#include <string.h>
class MBSplitVerticesBase;
+class MBEntitySource;
class MBParallelComm;
class MBMeshOutputFunctor : public MBEntityRefinerOutputFunctor
@@ -60,8 +61,9 @@
MBInterface* mesh_in;
MBInterface* mesh_out;
bool input_is_output;
+ MBSplitVerticesBase* vertex_map;
std::vector<MBSplitVerticesBase*> split_vertices;
- std::vector<MBSplitVerticesBase*> new_entities;
+ std::vector<MBEntitySource*> new_entities;
std::vector<MBEntityHandle> elem_vert;
MBRefinerTagManager* tag_manager;
MBEntityHandle destination_set;
Modified: MOAB/trunk/refiner/MBRefinerTagManager.cpp
===================================================================
--- MOAB/trunk/refiner/MBRefinerTagManager.cpp 2008-08-28 19:13:05 UTC (rev 2050)
+++ MOAB/trunk/refiner/MBRefinerTagManager.cpp 2008-08-29 03:21:07 UTC (rev 2051)
@@ -451,7 +451,8 @@
}
else
{
- //std::cout << " not shared | ";
+ // not shared, but everthing exists on this process, so make sure that bit is set...
+ common_shared_procs.set_process_member( this->rank );
}
}
std::cout << " Common procs " << common_shared_procs;
Modified: MOAB/trunk/refiner/MBSplitVertices.cpp
===================================================================
--- MOAB/trunk/refiner/MBSplitVertices.cpp 2008-08-28 19:13:05 UTC (rev 2050)
+++ MOAB/trunk/refiner/MBSplitVertices.cpp 2008-08-29 03:21:07 UTC (rev 2051)
@@ -13,3 +13,53 @@
{
}
+MBEntitySource::MBEntitySource( int nc, MBRefinerTagManager* tag_mgr )
+{
+ this->tag_manager = tag_mgr;
+ this->mesh_out = tag_mgr->get_output_mesh();
+ this->num_corners = nc;
+}
+
+MBEntitySource::~MBEntitySource()
+{
+}
+
+bool MBEntitySource::create_element(
+ MBEntityType etyp, int nconn, const MBEntityHandle* elem_verts, MBEntityHandle& elem_handle,
+ std::map<MBProcessSet,int>& proc_partition_counts )
+{
+ // Get the global IDs of the input vertices
+ int stat;
+ proc_partition_counts[this->tag_manager->get_element_procs()]++;
+ if ( this->mesh_out->create_element( etyp, elem_verts, nconn, elem_handle ) != MB_SUCCESS )
+ {
+ return false;
+ }
+ this->push_back( MBEntitySourceRecord( this->num_corners, elem_handle, this->tag_manager->get_element_procs() ) );
+ this->tag_manager->set_sharing( elem_handle, this->tag_manager->get_element_procs() );
+ return true;
+}
+
+void MBEntitySource::assign_global_ids( std::map<MBProcessSet,int>& gids )
+{
+ std::vector<MBEntityHandle> adjacencies;
+ adjacencies.resize( this->num_corners );
+ std::vector<MBEntitySourceRecord>::iterator it;
+ int stat;
+ for ( it = this->begin(); it != this->end(); ++ it )
+ {
+ int num_nodes;
+ const MBEntityHandle* conn;
+ this->mesh_out->get_connectivity( it->handle, conn, num_nodes );
+ stat = this->tag_manager->get_output_gids( this->num_corners, conn, it->ids );
+ std::sort( it->ids.begin(), it->ids.end() );
+ }
+ std::sort( this->begin(), this->end() );
+ for ( it = this->begin(); it != this->end(); ++ it )
+ {
+ int gid = gids[it->process_set] ++;
+ this->tag_manager->set_gid( it->handle, gid );
+ std::cout << "Assigning entity: " << it->handle << " GID: " << gid << "\n";
+ }
+}
+
Modified: MOAB/trunk/refiner/MBSplitVertices.hpp
===================================================================
--- MOAB/trunk/refiner/MBSplitVertices.hpp 2008-08-28 19:13:05 UTC (rev 2050)
+++ MOAB/trunk/refiner/MBSplitVertices.hpp 2008-08-29 03:21:07 UTC (rev 2051)
@@ -16,7 +16,7 @@
/**\class MBSplitVertices
*\brief A dictionary of new vertices.
*
- * An array of existing vertex handles used as a key in a dictionary of new vertices.
+ * An array of existing vertex ids used as a key in a dictionary of new vertices.
*/
#ifndef MB_SPLITVERTICES_HPP
#define MB_SPLITVERTICES_HPP
@@ -37,11 +37,11 @@
public:
MBSplitVertexIndex() { }
MBSplitVertexIndex( const int* src )
- { for ( int i = 0; i < _n; ++ i ) this->handles[i] = src[i]; std::sort( this->handles, this->handles + _n ); }
+ { for ( int i = 0; i < _n; ++ i ) this->ids[i] = src[i]; std::sort( this->ids, this->ids + _n ); }
MBSplitVertexIndex( const MBSplitVertexIndex<_n>& src )
- { for ( int i = 0; i < _n; ++ i ) this->handles[i] = src.handles[i]; this->process_set = src.process_set; }
+ { for ( int i = 0; i < _n; ++ i ) this->ids[i] = src.ids[i]; this->process_set = src.process_set; }
MBSplitVertexIndex& operator = ( const MBSplitVertexIndex<_n>& src )
- { for ( int i = 0; i < _n; ++ i ) this->handles[i] = src.handles[i]; this->process_set = src.process_set; return *this; }
+ { for ( int i = 0; i < _n; ++ i ) this->ids[i] = src.ids[i]; this->process_set = src.process_set; return *this; }
void set_common_processes( const MBProcessSet& procs )
{ this->process_set = procs; }
@@ -52,16 +52,16 @@
bool operator < ( const MBSplitVertexIndex<_n>& other ) const
{
- // Ignore the process set. Only program errors lead to mismatched process sets with identical handles.
+ // Ignore the process set. Only program errors lead to mismatched process sets with identical ids.
for ( int i = 0; i < _n; ++ i )
- if ( this->handles[i] < other.handles[i] )
+ if ( this->ids[i] < other.ids[i] )
return true;
- else if ( this->handles[i] > other.handles[i] )
+ else if ( this->ids[i] > other.ids[i] )
return false;
return false;
}
- int handles[_n + 1];
+ int ids[_n + 1];
MBProcessSet process_set;
};
@@ -70,13 +70,51 @@
{
for ( int i = 0; i < _n; ++ i )
{
- os << idx.handles[i] << " ";
+ os << idx.ids[i] << " ";
}
os << "(" << idx.process_set << ")";
return os;
}
-/** A non-templated base class that the template subclasses all share.
+class MBEntitySourceRecord
+{
+public:
+ MBEntitySourceRecord() { }
+ MBEntitySourceRecord( int nc, MBEntityHandle ent, const MBProcessSet& procs )
+ { this->ids.resize( nc ); this->handle = ent; this->process_set = procs; }
+ MBEntitySourceRecord( const MBEntitySourceRecord& src )
+ { this->handle = src.handle; this->process_set = src.process_set; this->ids = src.ids; }
+ MBEntitySourceRecord& operator = ( const MBEntitySourceRecord& src )
+ { this->handle = src.handle; this->process_set = src.process_set; this->ids = src.ids; return *this; }
+
+ void set_common_processes( const MBProcessSet& procs )
+ { this->process_set = procs; }
+ MBProcessSet& common_processes()
+ { return this->process_set; }
+ const MBProcessSet& common_processes() const
+ { return this->process_set; }
+
+ bool operator < ( const MBEntitySourceRecord& other ) const
+ {
+ //assert( this->ids.size() == other.ids.size() );
+ std::vector<int>::size_type N = this->ids.size();
+ std::vector<int>::size_type i;
+ // Ignore the process set. Only program errors lead to mismatched process sets with identical ids.
+ for ( i = 0; i < N; ++ i )
+ if ( this->ids[i] < other.ids[i] )
+ return true;
+ else if ( this->ids[i] > other.ids[i] )
+ return false;
+ return false;
+ }
+
+ std::vector<int> ids;
+ MBProcessSet process_set;
+ MBEntityHandle handle;
+};
+
+
+/** A non-templated base class that the MBSplitVertices template subclasses all share.
*
* All methods that need to be accessed by other classes should be
* declared by the base class so that no knowledge of template parameters
@@ -92,10 +130,6 @@
const MBEntityHandle* split_src, const double* coords, MBEntityHandle& vert_handle,
std::map<MBProcessSet,int>& proc_partition_counts, bool handles_on_output_mesh ) = 0;
- virtual bool create_element(
- MBEntityType etyp, int nconn, const MBEntityHandle* elem_verts, MBEntityHandle& elem_handle,
- std::map<MBProcessSet,int>& proc_partition_counts ) = 0;
-
virtual void assign_global_ids( std::map<MBProcessSet,int>& gids ) = 0;
MBInterface* mesh_out; // Output mesh. Needed for new vertex set in vert_handle
@@ -104,12 +138,39 @@
MBProcessSet common_shared_procs; // Holds intersection of several shared_procs_ins.
};
-/** A map from a set of pre-existing entities to a new mesh entity.
+/** A vector of pre-existing entities to a new mesh entity.
*
* This is used as a dictionary to determine whether a new vertex should be
* created on the given n-simplex (n being the template parameter) or whether
* it has already been created as part of the refinement of a neighboring entity.
*/
+class MBEntitySource : public std::vector<MBEntitySourceRecord>
+{
+public:
+ typedef std::vector<MBEntitySourceRecord> VecType;
+ typedef std::vector<MBEntitySourceRecord>::iterator VecIteratorType;
+
+ MBEntitySource( int num_corners, MBRefinerTagManager* tag_mgr );
+ ~MBEntitySource();
+ bool create_element(
+ MBEntityType etyp, int nconn, const MBEntityHandle* split_src, MBEntityHandle& elem_handle,
+ std::map<MBProcessSet,int>& proc_partition_counts );
+
+ void assign_global_ids( std::map<MBProcessSet,int>& gids );
+
+ MBInterface* mesh_out; // Output mesh. Needed for new vertex set in vert_handle
+ MBRefinerTagManager* tag_manager;
+ MBProcessSet common_shared_procs; // Holds intersection of several shared_procs_ins.
+ int num_corners;
+};
+
+
+/** A map from a set of pre-existing vertices to a new mesh vertex.
+ *
+ * This is used as a dictionary to determine whether a new vertex should be
+ * created on the given n-simplex (n being the template parameter) or whether
+ * it has already been created as part of the refinement of a neighboring entity.
+ */
template< int _n >
class MBSplitVertices : public std::map<MBSplitVertexIndex<_n>,MBEntityHandle>, public MBSplitVerticesBase
{
@@ -122,9 +183,6 @@
virtual bool find_or_create(
const MBEntityHandle* split_src, const double* coords, MBEntityHandle& vert_handle,
std::map<MBProcessSet,int>& proc_partition_counts, bool handles_on_output_mesh );
- virtual bool create_element(
- MBEntityType etyp, int nconn, const MBEntityHandle* split_src, MBEntityHandle& elem_handle,
- std::map<MBProcessSet,int>& proc_partition_counts );
virtual void assign_global_ids( std::map<MBProcessSet,int>& gids );
};
@@ -178,27 +236,6 @@
}
template< int _n >
-bool MBSplitVertices<_n>::create_element(
- MBEntityType etyp, int nconn, const MBEntityHandle* elem_verts, MBEntityHandle& elem_handle,
- std::map<MBProcessSet,int>& proc_partition_counts )
-{
- // Get the global IDs of the input vertices
- int stat;
- stat = this->tag_manager->get_input_gids( _n, elem_verts, this->split_gids );
- MBSplitVertexIndex<_n> key( &this->split_gids[0] );
- //this->tag_manager->get_common_processes( _n, elem_verts, this->common_shared_procs );
- proc_partition_counts[this->tag_manager->get_element_procs()]++;
- key.set_common_processes( this->tag_manager->get_element_procs() );
- if ( this->mesh_out->create_element( etyp, elem_verts, nconn, elem_handle ) != MB_SUCCESS )
- {
- return false;
- }
- (*this)[key] = elem_handle;
- this->tag_manager->set_sharing( elem_handle, this->tag_manager->get_element_procs() );
- return true;
-}
-
-template< int _n >
void MBSplitVertices<_n>::assign_global_ids( std::map<MBProcessSet,int>& gids )
{
typename std::map<MBSplitVertexIndex<_n>,MBEntityHandle>::iterator it;
1
0
Author: bmsmith
Date: 2008-08-28 14:13:05 -0500 (Thu, 28 Aug 2008)
New Revision: 2050
Modified:
MOAB/trunk/tools/mcnpmit/main.cpp
MOAB/trunk/tools/mcnpmit/mcnpmit.cpp
Log:
Sometimes a cfd point cannot be found in the tree. Instead of an assert failing, I've added an error message.
Added calculation of error and standard deviation, possibly useful for setting plot range in VisIt.
Modified: MOAB/trunk/tools/mcnpmit/main.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/main.cpp 2008-08-26 03:29:52 UTC (rev 2049)
+++ MOAB/trunk/tools/mcnpmit/main.cpp 2008-08-28 19:13:05 UTC (rev 2050)
@@ -188,6 +188,11 @@
MBCartVect tmp_cartvect;
std::vector<double> coords;
+ double tal_sum = 0.0,
+ err_sum = 0.0,
+ tal_sum_sqr = 0.0,
+ err_sum_sqr = 0.0;
+
// double davg = 0.0;
// unsigned int nmax = 0, nmin = 1000000000 ;
@@ -220,11 +225,27 @@
testvc[1] = transformed_pt[1];
testvc[2] = transformed_pt[2];
- // std::cout << n << " " << testvc << std::endl;
-
// Find the leaf containing the point
MBresult = kdtree.leaf_containing_point( root, transformed_pt, treeiter);
- assert(MBresult == MB_SUCCESS);
+ if (MB_SUCCESS != MBresult) {
+ double x, y, z;
+ if (CARTESIAN == coord_sys) {
+ x = testvc[0];
+ y = testvc[1];
+ z = testvc[2];
+ }
+ else if (CYLINDRICAL == coord_sys) {
+ x = testvc[0]*cos(2*M_PI*testvc[2]);
+ y = testvc[0]*sin(2*M_PI*testvc[2]);
+ z = testvc[1];
+ }
+ else {
+ assert(MB_SUCCESS == MBresult);
+ }
+ std::cout << "No leaf found, MCNP coord xyz=" << x << " " << y << " " << z << std::endl;
+ cfd_iter++;
+ continue;
+ }
range.clear();
MBresult = MBI -> get_entities_by_type( treeiter.handle(), MBHEX, range );
@@ -269,6 +290,11 @@
found = true;
elems_read++;
+
+ tal_sum = tal_sum + taldata;
+ err_sum = err_sum + errdata;
+ tal_sum_sqr = tal_sum_sqr + taldata*taldata;
+ err_sum_sqr = err_sum_sqr + errdata*errdata;
break;
}
@@ -293,6 +319,15 @@
std::cout << "Failure during query! " << elems_read << " elements interpolated." << std::endl << std::endl;
}
+
+ double tal_std_dev = sqrt( (1.0/elems_read)*(tal_sum_sqr - (1.0/elems_read)*tal_sum*tal_sum) );
+ double err_std_dev = sqrt( (1.0/elems_read)*(err_sum_sqr - (1.0/elems_read)*err_sum*err_sum) );
+
+ std::cout << "Tally Mean: " << tal_sum / elems_read << std::endl;
+ std::cout << "Tally Standard Deviation: " << tal_std_dev << std::endl;
+ std::cout << "Error Mean: " << err_sum / elems_read << std::endl;
+ std::cout << "Error Standard Deviation: " << err_std_dev << std::endl;
+
interp_time = clock() - build_time;
if (!read_qnv) {
Modified: MOAB/trunk/tools/mcnpmit/mcnpmit.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/mcnpmit.cpp 2008-08-26 03:29:52 UTC (rev 2049)
+++ MOAB/trunk/tools/mcnpmit/mcnpmit.cpp 2008-08-28 19:13:05 UTC (rev 2050)
@@ -421,12 +421,12 @@
// Transform coordinate system
switch( csys ) {
case CARTESIAN :
- r[0] = q[0]; r[1] = q[1]; r[2] = q[2];
+ r[0] = q[0]; r[1] = q[1]; r[2] = q[2]; // x, y, z
break;
case CYLINDRICAL :
- r[0] = sqrt( q[0]*q[0] + q[1]*q[1] );
- r[1] = q[2];
- r[2] = c2pi * ( atan2( q[1], q[0] ) );
+ r[0] = sqrt( q[0]*q[0] + q[1]*q[1] ); // r
+ r[1] = q[2]; // z
+ r[2] = c2pi * ( atan2( q[1], q[0] ) ); // theta (in rotations)
break;
case SPHERICAL :
return MCNP_FAILURE;
1
0
27 Aug '08
Not sure if this is the intended effect but
make distclean
deletes
tools/iMesh/SIDL/mserver/iMesh_Factory_Impl.cc
--
Valmor
2
1
Sorry for posting this but I don't seem to get any mail from this list.
--
Valmor
1
0
Hello,
Is this the normal output of
-> mpirun -np 4 mbparallelcomm_test 0 3 parallel/ptest.cub
When using moab rev 2047.
Thanks,
--
Valmor
Broadcasting mesh.
Reading file parallel/ptest.cub
Broadcasting mesh.
Checking global ids.
Getting fileset entities.
Broadcasting mesh.
Bcast done; entities:
Number of entities per type:
Vertex: 75
Edge: 146
Tri: 0
Quad: 80
Polygon: 0
Tet: 0
Pyramid: 0
Prism: 0
Knife: 0
Hex: 32
Polyhedron: 0
EntitySet: 76
Getting fileset entities.
Deleting nonlocal entities.
Number of entities per type:
Vertex: 75
Bcast done; entities:
Couldn't read mesh; error message:
Failed in step PARALLEL DELETE NONLOCAL
Number of procs greater than number of partitions.
Edge: 146
Tri: 0
Quad: 80
Polygon: 0
Tet: 0
Pyramid: 0
Prism: 0
Knife: 0
Hex: 32
Polyhedron: 0
EntitySet: 76
Getting fileset entities.
Deleting nonlocal entities.
Couldn't read mesh; error message:Broadcasting mesh.
Failed in step PARALLEL DELETE NONLOCAL
Number of procs greater than number of partitions.
Bcast done; entities:
Number of entities per type:
Vertex: 75
Edge: 146
Tri: 0
Quad: 80
Polygon: 0
Tet: 0
Pyramid: 0
Number of entities per type:
Bcast done; entities:
Vertex: 75
Edge: 146
Tri: 0
Quad: 80
Polygon: 0
Tet: 0
Prism: 0
Knife: 0
Hex: 32
Polyhedron: 0
EntitySet: 76
Deleting nonlocal entities.
Couldn't read mesh; error message:
Failed in step PARALLEL DELETE NONLOCAL
Number of procs greater than number of partitions.
Pyramid: 0
Prism: 0
Knife: 0
Hex: 32
Polyhedron: 0
EntitySet: 76
Getting fileset entities.
Deleting nonlocal entities.
Couldn't read mesh; error message:
Failed in step PARALLEL DELETE NONLOCAL
Number of procs greater than number of partitions.
Proc 2: Success.
Proc 1: Success.
Proc 3: Success.
Proc 0: Success.
Times: 0.0222449 0.0222418 -1.21972e+09 3.14295e-39 1.21972e+09
(total/read/shared/report/delete)
2
1
Author: dcthomp
Date: 2008-08-25 22:29:52 -0500 (Mon, 25 Aug 2008)
New Revision: 2049
Modified:
MOAB/trunk/refiner/MBMeshOutputFunctor.cpp
MOAB/trunk/refiner/MBMeshRefiner.cpp
MOAB/trunk/refiner/MBRefinerTagManager.cpp
MOAB/trunk/refiner/MBRefinerTagManager.hpp
MOAB/trunk/refiner/MBSplitVertices.hpp
Log:
ENH: Add some state to the tag manager to keep track of
which processes share the element currently being refined.
BUG: Fix mismatch in number of interface entries (wasn't
properly setting the sharing information on refined
entities... the vertices were correct but elements
were not).
ENH: Start of work to copy element tag data from the original
element to the subdivided versions. Incomplete.
Modified: MOAB/trunk/refiner/MBMeshOutputFunctor.cpp
===================================================================
--- MOAB/trunk/refiner/MBMeshOutputFunctor.cpp 2008-08-25 23:02:57 UTC (rev 2048)
+++ MOAB/trunk/refiner/MBMeshOutputFunctor.cpp 2008-08-26 03:29:52 UTC (rev 2049)
@@ -255,7 +255,7 @@
{
std::cout << " *** ";
// FIXME: Handle tag assignment for elements as well as vertices
- //this->assign_tags( elem_handle, this->element_tag_data );
+ this->tag_manager->assign_element_tags( elem_handle );
}
std::cout << "---------> " << elem_handle << " ( " << etyp << " )\n\n";
this->elem_vert.clear();
Modified: MOAB/trunk/refiner/MBMeshRefiner.cpp
===================================================================
--- MOAB/trunk/refiner/MBMeshRefiner.cpp 2008-08-25 23:02:57 UTC (rev 2048)
+++ MOAB/trunk/refiner/MBMeshRefiner.cpp 2008-08-26 03:29:52 UTC (rev 2049)
@@ -111,16 +111,24 @@
MBRange set_ents;
if ( this->mesh_in->get_entities_by_handle( *it, set_ents, false ) == MB_SUCCESS )
{
+ // Create a matching set on the output mesh.
MBMeshRefinerIterator set_work;
unsigned int set_work_opts;
this->mesh_in->get_meshset_options( *it, set_work_opts );
this->mesh_out->create_meshset( set_work_opts, set_work.destination_set );
set_work.subset = set_ents;
work.push_back( set_work );
+ // Copy any per-element tag values the user has requested to the output set.
+ this->tag_manager->set_element_tags_from_ent( *it );
+ this->tag_manager->assign_element_tags( set_work.destination_set );
+ // Copy the global ID to the new set (assuming it exists).
+ this->tag_manager->copy_gid( *it, set_work.destination_set );
}
}
else
{
+ this->tag_manager->set_element_tags_from_ent( *it );
+ this->tag_manager->set_element_procs_from_ent( *it );
this->entity_refiner->refine_entity( etyp, *it );
}
}
Modified: MOAB/trunk/refiner/MBRefinerTagManager.cpp
===================================================================
--- MOAB/trunk/refiner/MBRefinerTagManager.cpp 2008-08-25 23:02:57 UTC (rev 2048)
+++ MOAB/trunk/refiner/MBRefinerTagManager.cpp 2008-08-26 03:29:52 UTC (rev 2049)
@@ -20,6 +20,7 @@
this->input_mesh = in_mesh;
this->output_mesh = out_mesh;
this->reset_vertex_tags();
+ this->reset_element_tags();
MBParallelComm* ipcomm = MBParallelComm::get_pcomm( this->input_mesh, 0 );
MBParallelComm* opcomm = 0;
if ( this->output_mesh != this->input_mesh )
@@ -169,6 +170,55 @@
*\brief Return the number of tags that will be output with each new vertex.
*/
+/// Clear the list of tag values that will appear past the element coordinates in \a p0, \a p1, and \a p2.
+void MBRefinerTagManager::reset_element_tags()
+{
+ this->element_size = 0;
+ this->input_element_tags.clear();
+ this->output_element_tags.clear();
+ this->element_tag_data.clear();
+}
+
+/** Add a tag to the list of tag values that will appear past the element coordinates.
+ * The return value is the offset into each element coordinate pointer (\a p0, \a p1, \a p2) where the
+ * tag value(s) will be stored.
+ */
+int MBRefinerTagManager::add_element_tag( MBTag tag_handle )
+{
+ int offset = this->element_size; // old size is offset of tag being added
+ int tag_size;
+ MBTagType tagType;
+ if ( this->input_mesh->tag_get_size( tag_handle, tag_size ) != MB_SUCCESS )
+ return -1;
+
+ if ( this->input_mesh->tag_get_type( tag_handle, tagType ) != MB_SUCCESS )
+ return -1;
+
+ if ( tagType == MB_TAG_BIT )
+ {
+ // Pad any bit tags to a size in full bytes.
+ tag_size = ( tag_size % 8 ? 1 : 0 ) + ( tag_size / 8 );
+ }
+
+ // Now pad so that the next tag will be word-aligned:
+ while ( tag_size % sizeof(int) )
+ ++tag_size;
+
+ this->element_size += tag_size;
+ this->element_tag_data.resize( this->element_size );
+
+ this->input_element_tags.push_back( std::pair< MBTag, int >( tag_handle, offset ) );
+ return offset;
+}
+
+/**\fn int MBRefinerTagManager::get_element_tag_size()
+ *\brief Return the number of bytes to allocate for tag data per point.
+ */
+
+/**\fn int MBRefinerTagManager::get_number_of_element_tags() const
+ *\brief Return the number of tags that will be output with each new element.
+ */
+
/**\brief Populate the list of output tags to match the list of input tags.
*
* When the input mesh and output mesh pointers are identical, this simply copies the list of input tags.
@@ -179,41 +229,14 @@
if ( this->input_mesh == this->output_mesh )
{
this->output_vertex_tags = this->input_vertex_tags;
+ this->output_element_tags = this->input_element_tags;
return;
}
- std::pair< MBTag, int > tag_rec;
std::vector< std::pair< MBTag, int > >::iterator it;
- std::vector< char > tag_default;
- std::string tag_name;
- MBTagType tag_type;
- MBDataType tag_data_type;
- int tag_size;
for ( it = this->input_vertex_tags.begin(); it != this->input_vertex_tags.end(); ++ it )
{
- MBTag tag_in = it->first;
- tag_rec.second = it->second;
- this->input_mesh->tag_get_name( tag_in, tag_name );
- this->input_mesh->tag_get_size( tag_in, tag_size );
- this->input_mesh->tag_get_type( tag_in, tag_type );
- this->input_mesh->tag_get_data_type( tag_in, tag_data_type );
- this->input_mesh->tag_get_default_value( tag_in, (void*) &tag_default[0] );
- tag_default.resize( tag_size );
- MBErrorCode res = this->output_mesh->tag_create(
- tag_name.c_str(), tag_size, tag_type, tag_data_type, tag_rec.first, (void*) &tag_default[0], true );
- std::cout
- << "Creating output tag: \"" << tag_name.c_str() << "\" handle: " << tag_rec.first
- << " input handle: " << tag_in << "\n";
- if ( res == MB_FAILURE )
- {
- std::cerr
- << "Could not create output tag name: \"" << tag_name.c_str() << "\" type: "
- << tag_type << " data type: " << tag_data_type << "\n";
- }
- else
- {
- this->output_vertex_tags.push_back( tag_rec );
- }
+ this->create_tag_internal( it->first, it->second );
}
}
@@ -306,6 +329,23 @@
return this->output_mesh->tag_set_data( this->tag_ogid, &ent, 1, &gid );
}
+/**\brief Copy a global ID from an entity of the input mesh to an entity of the output mesh.
+ *
+ * @param[in] ent_input An entity on the input mesh with a global ID.
+ * @param[in] ent_output An entity on the output mesh whose global ID should be set.
+ * @retval Normally MB_SUCCESS, but returns other values if tag_get_data or tag_set_data fail.
+ */
+int MBRefinerTagManager::copy_gid( MBEntityHandle ent_input, MBEntityHandle ent_output )
+{
+ int gid = -1;
+ int status;
+ if ( ( status = this->input_mesh->tag_get_data( this->tag_igid, &ent_input, 1, &gid ) ) == MB_SUCCESS )
+ {
+ status = this->output_mesh->tag_set_data( this->tag_ogid, &ent_output, 1, &gid );
+ }
+ return status;
+}
+
/**\brief Set parallel status and sharing process list on an entity.
*
* This sets tag values for the PARALLEL_STATUS and one of PARALLEL_SHARED_PROC or PARALLEL_SHARED_PROCS tags
@@ -418,3 +458,54 @@
std::cout << "\n";
}
+void MBRefinerTagManager::create_tag_internal( MBTag tag_in, int offset )
+{
+ std::pair< MBTag, int > tag_rec;
+ std::vector< char > tag_default;
+ std::string tag_name;
+ MBTagType tag_type;
+ MBDataType tag_data_type;
+ int tag_size;
+
+ tag_rec.second = offset;
+ this->input_mesh->tag_get_name( tag_in, tag_name );
+ this->input_mesh->tag_get_size( tag_in, tag_size );
+ this->input_mesh->tag_get_type( tag_in, tag_type );
+ this->input_mesh->tag_get_data_type( tag_in, tag_data_type );
+ this->input_mesh->tag_get_default_value( tag_in, (void*) &tag_default[0] );
+ tag_default.resize( tag_size );
+ MBErrorCode res = this->output_mesh->tag_create(
+ tag_name.c_str(), tag_size, tag_type, tag_data_type, tag_rec.first, (void*) &tag_default[0], true );
+ std::cout
+ << "Creating output tag: \"" << tag_name.c_str() << "\" handle: " << tag_rec.first
+ << " input handle: " << tag_in << "\n";
+ if ( res == MB_FAILURE )
+ {
+ std::cerr
+ << "Could not create output tag name: \"" << tag_name.c_str() << "\" type: "
+ << tag_type << " data type: " << tag_data_type << "\n";
+ }
+ else
+ {
+ this->output_vertex_tags.push_back( tag_rec );
+ }
+}
+
+void MBRefinerTagManager::set_element_tags_from_ent( MBEntityHandle ent_input )
+{
+ std::vector< std::pair< MBTag, int > >::iterator it;
+ for ( it = this->input_element_tags.begin(); it != this->input_element_tags.end(); ++ it )
+ {
+ this->input_mesh->tag_get_data( it->first, &ent_input, 1, &this->element_tag_data[it->second] );
+ }
+}
+
+void MBRefinerTagManager::assign_element_tags( MBEntityHandle ent_output )
+{
+ std::vector< std::pair< MBTag, int > >::iterator it;
+ for ( it = this->output_element_tags.begin(); it != this->output_element_tags.end(); ++ it )
+ {
+ this->output_mesh->tag_set_data( it->first, &ent_output, 1, &this->element_tag_data[it->second] );
+ }
+}
+
Modified: MOAB/trunk/refiner/MBRefinerTagManager.hpp
===================================================================
--- MOAB/trunk/refiner/MBRefinerTagManager.hpp 2008-08-25 23:02:57 UTC (rev 2048)
+++ MOAB/trunk/refiner/MBRefinerTagManager.hpp 2008-08-26 03:29:52 UTC (rev 2049)
@@ -45,11 +45,19 @@
int get_vertex_tag_size() const { return this->vertex_size; }
int get_number_of_vertex_tags() const { return this->input_vertex_tags.size(); }
+ void reset_element_tags();
+ int add_element_tag( MBTag tag_handle );
+ int get_element_tag_size() const { return this->element_size; }
+ int get_number_of_element_tags() const { return this->input_element_tags.size(); }
+
void create_output_tags();
void get_input_vertex_tag( int i, MBTag& tag, int& byte_offset );
void get_output_vertex_tag( int i, MBTag& tag, int& byte_offset );
+ void get_input_element_tag( int i, MBTag& tag, int& byte_offset );
+ void get_output_element_tag( int i, MBTag& tag, int& byte_offset );
+
MBInterface* get_input_mesh() { return this->input_mesh; }
MBInterface* get_output_mesh() { return this->output_mesh; }
@@ -60,14 +68,36 @@
int get_input_gids( int n, const MBEntityHandle* ents, std::vector<int>& gids );
int get_output_gids( int n, const MBEntityHandle* ents, std::vector<int>& gids );
int set_gid( MBEntityHandle ent, int gid );
+ int copy_gid( MBEntityHandle ent_input, MBEntityHandle ent_output );
void set_sharing( MBEntityHandle ent_handle, MBProcessSet& procs );
void get_common_processes( int num, const MBEntityHandle* src, MBProcessSet& common_shared_procs, bool on_output_mesh = true );
+ void set_element_tags_from_ent( MBEntityHandle ent_input );
+ void assign_element_tags( MBEntityHandle ent_output );
+
+ void set_element_procs_from_ent( MBEntityHandle ent_input )
+ {
+ this->get_common_processes( 1, &ent_input, this->current_element_procs, false );
+ }
+ MBProcessSet& get_element_procs()
+ {
+ return this->current_element_procs;
+ }
+ void set_element_sharing( MBEntityHandle ent_output )
+ {
+ this->set_sharing( ent_output, this->current_element_procs );
+ }
+
protected:
+ void create_tag_internal( MBTag, int );
+
std::vector< std::pair< MBTag, int > > input_vertex_tags;
std::vector< std::pair< MBTag, int > > output_vertex_tags;
+ std::vector< std::pair< MBTag, int > > input_element_tags;
+ std::vector< std::pair< MBTag, int > > output_element_tags;
int vertex_size;
+ int element_size;
MBInterface* input_mesh;
MBInterface* output_mesh;
MBTag tag_ipstatus; // Handle for PARALLEL_STATUS on mesh_in
@@ -86,6 +116,8 @@
std::vector<int> shared_procs_in; // Used to hold procs sharing an input vert.
std::vector<int> shared_procs_out; // Used to hold procs sharing an output entity.
MBProcessSet current_shared_procs; // Holds process list as it is being accumulated
+ MBProcessSet current_element_procs; // The list of processes which should share an output element.
+ std::vector<char> element_tag_data; // Holds tag data for per-element tags
};
#endif // MB_REFINERTAGMANAGER_H
Modified: MOAB/trunk/refiner/MBSplitVertices.hpp
===================================================================
--- MOAB/trunk/refiner/MBSplitVertices.hpp 2008-08-25 23:02:57 UTC (rev 2048)
+++ MOAB/trunk/refiner/MBSplitVertices.hpp 2008-08-26 03:29:52 UTC (rev 2049)
@@ -186,15 +186,15 @@
int stat;
stat = this->tag_manager->get_input_gids( _n, elem_verts, this->split_gids );
MBSplitVertexIndex<_n> key( &this->split_gids[0] );
- this->tag_manager->get_common_processes( _n, elem_verts, this->common_shared_procs );
- proc_partition_counts[this->common_shared_procs]++;
- key.set_common_processes( this->common_shared_procs );
+ //this->tag_manager->get_common_processes( _n, elem_verts, this->common_shared_procs );
+ proc_partition_counts[this->tag_manager->get_element_procs()]++;
+ key.set_common_processes( this->tag_manager->get_element_procs() );
if ( this->mesh_out->create_element( etyp, elem_verts, nconn, elem_handle ) != MB_SUCCESS )
{
return false;
}
(*this)[key] = elem_handle;
- this->tag_manager->set_sharing( elem_handle, this->common_shared_procs );
+ this->tag_manager->set_sharing( elem_handle, this->tag_manager->get_element_procs() );
return true;
}
1
0
Hello,
I think the output below is not correct (moab rev 2047). Any help
appreciated.
Thanks,
--
Valmor
-> mpirun -np 2 parallel/pcomm_unit
Running test_pack_vertices ...
Running test_pack_vertices ...
Running test_pack_elements ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_vertices: FAILED
Running test_pack_elements ...
Running test_pack_higher_order ...
Running test_pack_poly ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
Running test_pack_sets_simple ...
test_pack_elements: FAILED
Running test_pack_higher_order ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_higher_order: FAILED
Running test_pack_poly ...
Running test_pack_set_contents ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
Running test_pack_sets_of_sets ...
test_pack_poly: FAILED
Running test_pack_sets_simple ...
Running test_pack_set_parent_child ...
Running test_pack_tag_data ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_sets_simple: FAILED
Running test_pack_set_contents ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_set_contents: FAILED
Running test_pack_sets_of_sets ...
Running test_pack_variable_length_tag ...
Running test_pack_set_parent_child ...
Running test_pack_tag_handle_data ...
Running test_pack_tag_data ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_tag_data: FAILED
Running test_pack_variable_length_tag ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_variable_length_tag: FAILED
Running test_pack_tag_handle_data ...
MBErrorCode Test Failed: MB_SUCCESS == rval
at line 86 of 'pcomm_unit.cpp'
Expected value: Success (0)
Actual value: Memory Alloc. Failed (3)
test_pack_tag_handle_data: FAILED
1
0
Author: dcthomp
Date: 2008-08-25 18:02:57 -0500 (Mon, 25 Aug 2008)
New Revision: 2048
Modified:
MOAB/trunk/refiner/MBEntityRefiner.hpp
MOAB/trunk/refiner/MBMeshOutputFunctor.cpp
MOAB/trunk/refiner/MBMeshOutputFunctor.hpp
MOAB/trunk/refiner/MBProcessSet.cpp
MOAB/trunk/refiner/MBRefinerTagManager.cpp
MOAB/trunk/refiner/MBRefinerTagManager.hpp
MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp
MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp
MOAB/trunk/refiner/MBSplitVertices.cpp
MOAB/trunk/refiner/MBSplitVertices.hpp
MOAB/trunk/refiner/test_mesh_refiner.cpp
Log:
ENH: Checkpoint of progress. The input mesh and output mesh
need not be the same any longer.
STYLE: Moved some code dealing with parallel status/sharing
tags from the output functor to the tag manager.
Modified: MOAB/trunk/refiner/MBEntityRefiner.hpp
===================================================================
--- MOAB/trunk/refiner/MBEntityRefiner.hpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBEntityRefiner.hpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -52,6 +52,10 @@
* one used for appending a vertex to an entity,
* the other used to finalize the creation of the entity by specifying its type.
*
+ * You are also responsible for implementing the map_vertex() function to map an input vertex handle
+ * into an output vertex handle (which may then be appended to an entity using the first form
+ * of the parenthesis operator above).
+ *
* \author David Thompson
* \author Philippe Pebay
*
@@ -72,7 +76,16 @@
{
public:
virtual ~MBEntityRefinerOutputFunctor() { }
- virtual MBEntityHandle operator () ( MBEntityHandle vhash, const double* vcoords, const void* vtags ) = 0;
+ /// Map an input vertex to the output mesh. This should return the same value when given the same input across multiple calls.
+ virtual MBEntityHandle map_vertex( MBEntityHandle vhash, const double* vcoords, const void* vtags ) = 0;
+ /**\brief Create a new vertex along an edge.
+ *
+ * @param[in] h0 An edge endpoint handle on the output mesh.
+ * @param[in] h1 An edge endpoint handle on the output mesh.
+ * @param[in] vcoords The location of the midpoint in world coordinates.
+ * @param[in] vtags Field values at the midpoint.
+ * @retval A handle for the midpoint on the output mesh.
+ */
MBEntityHandle operator () ( MBEntityHandle h0, MBEntityHandle h1, const double* vcoords, const void* vtags )
{
MBEntityHandle harr[2];
@@ -80,6 +93,15 @@
harr[1] = h1;
return (*this)( 2, harr, vcoords, vtags );
}
+ /**\brief Create a new vertex on a triangular face.
+ *
+ * @param[in] h0 A triangle corner handle on the output mesh.
+ * @param[in] h1 A triangle corner handle on the output mesh.
+ * @param[in] h2 A triangle corner handle on the output mesh.
+ * @param[in] vcoords The location of the mid-face point in world coordinates.
+ * @param[in] vtags Field values at the mid-face point.
+ * @retval A handle for the mid-face point on the output mesh.
+ */
virtual MBEntityHandle operator () ( MBEntityHandle h0, MBEntityHandle h1, MBEntityHandle h2, const double* vcoords, const void* vtags )
{
MBEntityHandle harr[3];
@@ -88,8 +110,25 @@
harr[2] = h2;
return (*this)( 3, harr, vcoords, vtags );
}
+ /**\brief Create a new vertex along a \f$k\f$-facet.
+ *
+ * @param[in] nhash The number of corner vertices (i.e, \f$k\f$ ).
+ * @param[in] hash An array of corner handles on the output mesh.
+ * @param[in] vcoords The location of the new point in world coordinates.
+ * @param[in] vtags Field values at the new point.
+ * @retval A handle for the new point on the output mesh.
+ */
virtual MBEntityHandle operator () ( int nhash, MBEntityHandle* hash, const double* vcoords, const void* vtags ) = 0;
+ /**\brief Append an output vertex to the list of vertices defining a new entity.
+ *
+ * @param[in] vhash A vertex of the output mesh.
+ */
virtual void operator () ( MBEntityHandle vhash ) = 0;
+ /**\brief Create a new entity from all previously appended output vertices.
+ *
+ * This resets the list of appended vertices.
+ * @param[in] etyp The type of entity to create.
+ */
virtual void operator () ( MBEntityType etyp ) = 0;
};
Modified: MOAB/trunk/refiner/MBMeshOutputFunctor.cpp
===================================================================
--- MOAB/trunk/refiner/MBMeshOutputFunctor.cpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBMeshOutputFunctor.cpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -26,22 +26,24 @@
// Hold information about newly-created mesh entities (other than split vertices)
// This is necessary in order for global IDs to be assigned consistently across processes.
- this->new_entities.resize( 4 );
+ this->new_entities.resize( 5 );
this->new_entities[0] = new MBSplitVertices<0>( this->tag_manager );
this->new_entities[1] = new MBSplitVertices<1>( this->tag_manager );
this->new_entities[2] = new MBSplitVertices<2>( this->tag_manager );
this->new_entities[3] = new MBSplitVertices<3>( this->tag_manager );
+ this->new_entities[4] = new MBSplitVertices<4>( this->tag_manager );
}
MBMeshOutputFunctor::~MBMeshOutputFunctor()
{
- for ( int i = 0; i < 4; ++ i )
+ for ( int i = 1; i < 4; ++ i )
delete this->split_vertices[i];
- for ( int i = 0; i < 4; ++ i )
+ for ( int i = 0; i < 5; ++ i )
delete this->new_entities[i];
}
-void MBMeshOutputFunctor::print_vert_crud( MBEntityHandle vout, int nvhash, MBEntityHandle* vhash, const double* vcoords, const void* vtags )
+void MBMeshOutputFunctor::print_vert_crud(
+ MBEntityHandle vout, int nvhash, MBEntityHandle* vhash, const double* vcoords, const void* vtags )
{
std::cout << "+ {";
for ( int i = 0; i < nvhash; ++ i )
@@ -63,6 +65,9 @@
#endif // 0
std::cout << " >\n";
+ //std::cout << "##############################\n";
+ //this->mesh_out->list_entities( 0, 1 );
+ //std::cout << "##############################\n";
}
void MBMeshOutputFunctor::assign_global_ids( MBParallelComm* comm )
@@ -144,10 +149,12 @@
std::cout << "Partition " << pcit->first << ": " << pcit->second << " # [" << gids[pcit->first] << "]\n";
}
std::vector<MBSplitVerticesBase*>::iterator vit;
- for ( vit = this->split_vertices.begin(); vit != this->split_vertices.end(); ++ vit )
+ vit = this->split_vertices.begin();
+ ++ vit; // Skip split_vertices[0] since it's empty.
+ ++ vit; // Skip split_vertices[1] since those entries already have global IDs... they exist in the input mesh.
+ for ( /* skip */; vit != this->split_vertices.end(); ++ vit )
{
- if ( *vit )
- (*vit)->assign_global_ids( gids );
+ (*vit)->assign_global_ids( gids );
}
for ( vit = this->new_entities.begin(); vit != this->new_entities.end(); ++ vit )
{
@@ -156,6 +163,10 @@
}
}
+void MBMeshOutputFunctor::exchange_handles( MBParallelComm* comm )
+{
+}
+
void MBMeshOutputFunctor::assign_tags( MBEntityHandle vhandle, const void* vtags )
{
if ( ! vhandle )
@@ -171,7 +182,7 @@
}
}
-MBEntityHandle MBMeshOutputFunctor::operator () ( MBEntityHandle vhash, const double* vcoords, const void* vtags )
+MBEntityHandle MBMeshOutputFunctor::map_vertex( MBEntityHandle vhash, const double* vcoords, const void* vtags )
{
if ( this->input_is_output )
{ // Don't copy the original vertex!
@@ -179,11 +190,16 @@
return vhash;
}
MBEntityHandle vertex_handle;
- bool newly_created = this->new_entities[0]->find_or_create(
- &vhash, vcoords, vertex_handle, this->proc_partition_counts );
+ bool newly_created = this->new_entities[1]->find_or_create(
+ &vhash, vcoords, vertex_handle, this->proc_partition_counts, false );
if ( newly_created )
{
+ std::vector<int> gid;
this->assign_tags( vertex_handle, vtags );
+ if ( this->tag_manager->get_input_gids( 1, &vhash, gid ) == MB_SUCCESS )
+ {
+ this->tag_manager->set_gid( vertex_handle, gid[0] );
+ }
}
if ( ! vertex_handle )
{
@@ -196,14 +212,10 @@
MBEntityHandle MBMeshOutputFunctor::operator () ( int nvhash, MBEntityHandle* vhash, const double* vcoords, const void* vtags )
{
MBEntityHandle vertex_handle;
- if ( nvhash == 1 )
+ if ( nvhash < 4 )
{
- vertex_handle = (*this)( *vhash, vcoords, vtags );
- }
- else if ( nvhash < 4 )
- {
bool newly_created = this->split_vertices[nvhash]->find_or_create(
- vhash, vcoords, vertex_handle, this->proc_partition_counts );
+ vhash, vcoords, vertex_handle, this->proc_partition_counts, true );
if ( newly_created )
{
this->assign_tags( vertex_handle, vtags );
@@ -212,6 +224,7 @@
{
std::cerr << "Could not insert mid-edge vertex!\n";
}
+ std::cout << "(-" << nvhash << "-) ";
this->print_vert_crud( vertex_handle, nvhash, vhash, vcoords, vtags );
}
else
@@ -225,31 +238,26 @@
void MBMeshOutputFunctor::operator () ( MBEntityHandle h )
{
std::cout << h << " ";
- this->elem_vert.push_back( h );
if ( ! this->input_is_output )
{
// FIXME: Copy to output mesh
}
+ this->elem_vert.push_back( h );
}
void MBMeshOutputFunctor::operator () ( MBEntityType etyp )
{
MBEntityHandle elem_handle;
int nconn = this->elem_vert.size();
- if ( this->mesh_out->create_element( etyp, &this->elem_vert[0], nconn, elem_handle ) == MB_FAILURE )
- {
- std::cerr << " *** ";
- }
- std::cout << "---------> " << elem_handle << " ( " << etyp << " )\n\n";
-#if 0
bool newly_created = this->new_entities[nconn]->create_element(
- &this->elem_vert[0], elem_handle, this->proc_partition_counts );
+ etyp, nconn, &this->elem_vert[0], elem_handle, this->proc_partition_counts );
if ( newly_created )
{
+ std::cout << " *** ";
// FIXME: Handle tag assignment for elements as well as vertices
//this->assign_tags( elem_handle, this->element_tag_data );
}
-#endif // 0
+ std::cout << "---------> " << elem_handle << " ( " << etyp << " )\n\n";
this->elem_vert.clear();
}
Modified: MOAB/trunk/refiner/MBMeshOutputFunctor.hpp
===================================================================
--- MOAB/trunk/refiner/MBMeshOutputFunctor.hpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBMeshOutputFunctor.hpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -48,10 +48,11 @@
void print_vert_crud( MBEntityHandle vout, int nvhash, MBEntityHandle* vhash, const double* vcoords, const void* vtags );
void assign_global_ids( MBParallelComm* comm );
+ void exchange_handles( MBParallelComm* comm );
void assign_tags( MBEntityHandle vhandle, const void* vtags );
- virtual MBEntityHandle operator () ( MBEntityHandle vhash, const double* vcoords, const void* vtags );
+ virtual MBEntityHandle map_vertex( MBEntityHandle vhash, const double* vcoords, const void* vtags );
virtual MBEntityHandle operator () ( int nvhash, MBEntityHandle* vhash, const double* vcoords, const void* vtags );
virtual void operator () ( MBEntityHandle h );
virtual void operator () ( MBEntityType etyp );
Modified: MOAB/trunk/refiner/MBProcessSet.cpp
===================================================================
--- MOAB/trunk/refiner/MBProcessSet.cpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBProcessSet.cpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -95,6 +95,10 @@
}
}
}
+ for ( i = procs.size(); i < MAX_SHARING_PROCS; ++ i )
+ {
+ procs.push_back( -1 ); // pad with invalid values
+ }
return rank_owner;
}
Modified: MOAB/trunk/refiner/MBRefinerTagManager.cpp
===================================================================
--- MOAB/trunk/refiner/MBRefinerTagManager.cpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBRefinerTagManager.cpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -2,12 +2,16 @@
#include "MBInterface.hpp"
#include "MBParallelComm.hpp"
+#include "MBParallelConventions.h"
+#include "MBTagConventions.hpp"
#include <iostream>
+#include <stdexcept>
#include <assert.h>
/// Construct an evaluator.
MBRefinerTagManager::MBRefinerTagManager( MBInterface* in_mesh, MBInterface* out_mesh )
+ : shared_procs_in( 5 * MAX_SHARING_PROCS, -1 ), shared_procs_out( MAX_SHARING_PROCS, -1 )
{
assert( in_mesh );
if ( ! out_mesh )
@@ -17,19 +21,76 @@
this->output_mesh = out_mesh;
this->reset_vertex_tags();
MBParallelComm* ipcomm = MBParallelComm::get_pcomm( this->input_mesh, 0 );
+ MBParallelComm* opcomm = 0;
+ if ( this->output_mesh != this->input_mesh )
+ {
+ opcomm = MBParallelComm::get_pcomm( this->output_mesh, 0 );
+ if ( ! opcomm )
+ {
+ std::cout << "Creating opcomm: " << opcomm << "\n";
+ opcomm = new MBParallelComm( this->output_mesh, MPI_COMM_WORLD );
+ }
+ }
+ else
+ {
+ opcomm = ipcomm;
+ }
+
if ( ipcomm )
{
ipcomm->get_shared_proc_tags(
- this->tag_psproc, this->tag_psprocs,
- this->tag_pshand, this->tag_pshands,
- this->tag_pstatus );
+ this->tag_ipsproc, this->tag_ipsprocs,
+ this->tag_ipshand, this->tag_ipshands,
+ this->tag_ipstatus );
}
else
{
- this->tag_psproc = this->tag_psprocs = 0;
- this->tag_pshand = this->tag_pshands = 0;
- this->tag_pstatus = 0;
+ this->tag_ipsproc = this->tag_ipsprocs = 0;
+ this->tag_ipshand = this->tag_ipshands = 0;
+ this->tag_ipstatus = 0;
}
+
+ if ( opcomm )
+ {
+ opcomm->get_shared_proc_tags(
+ this->tag_opsproc, this->tag_opsprocs,
+ this->tag_opshand, this->tag_opshands,
+ this->tag_opstatus );
+ }
+ else
+ {
+ this->tag_opsproc = this->tag_opsprocs = 0;
+ this->tag_opshand = this->tag_opshands = 0;
+ this->tag_opstatus = 0;
+ }
+
+ this->rank =
+ ipcomm ? ipcomm->proc_config().proc_rank() :
+ ( opcomm ? opcomm->proc_config().proc_rank() : 0 );
+
+ // Create the mesh global ID tags if they aren't already there.
+ int zero = 0;
+ MBErrorCode result;
+ result = this->input_mesh->tag_create(
+ GLOBAL_ID_TAG_NAME, sizeof(int), MB_TAG_DENSE, MB_TYPE_INTEGER, this->tag_igid, &zero, true );
+ if ( result != MB_SUCCESS && result != MB_ALREADY_ALLOCATED )
+ {
+ throw new std::logic_error( "Unable to find input mesh global ID tag \"" GLOBAL_ID_TAG_NAME "\"" );
+ }
+ result = this->output_mesh->tag_create(
+ GLOBAL_ID_TAG_NAME, sizeof(int), MB_TAG_DENSE, MB_TYPE_INTEGER, this->tag_ogid, &zero, true );
+ if ( result != MB_SUCCESS && result != MB_ALREADY_ALLOCATED )
+ {
+ throw new std::logic_error( "Unable to find/create output mesh global ID tag \"" GLOBAL_ID_TAG_NAME "\"" );
+ }
+
+ std::cout
+ << "psproc: " << this->tag_ipsproc << ", " << this->tag_opsproc << "\n"
+ << "psprocs: " << this->tag_ipsprocs << ", " << this->tag_opsprocs << "\n"
+ << "pshand: " << this->tag_ipshand << ", " << this->tag_opshand << "\n"
+ << "pshands: " << this->tag_ipshands << ", " << this->tag_opshands << "\n"
+ << "pstatus: " << this->tag_ipstatus << ", " << this->tag_opstatus << "\n"
+ << "gid: " << this->tag_igid << ", " << this->tag_ogid << "\n";
}
/// Destruction is virtual so subclasses may clean up after refinement.
@@ -181,3 +242,179 @@
tag = it->first;
byte_offset = it->second;
}
+
+/**\brief Retrieve the global ID of each input entity and push it onto the output vector.
+ *
+ * The \a gids array is emptied by this call before any new values are added.
+ * Note that this routine fetches global IDs from the input mesh, not the output mesh;
+ * your entity handles must be from the input mesh.
+ *
+ * @param[in] ents An array of entities in the input mesh whose global IDs you desire
+ * @param[in] n The number of entities in the \a ents array.
+ * @param[out] gids A vector to contain the resulting global IDs.
+ * @retval A MOAB error code as supplied by the MBInterface::tag_get_data() call.
+ */
+int MBRefinerTagManager::get_input_gids( int n, const MBEntityHandle* ents, std::vector<int>& gids )
+{
+ int stat;
+ gids.clear();
+ for ( int i = 0; i < n; ++ i )
+ {
+ int gid = -1;
+ stat |= this->input_mesh->tag_get_data( this->tag_igid, ents + i, 1, &gid );
+ gids.push_back( gid );
+ }
+ return stat;
+}
+
+/**\brief Retrieve the global ID of each output entity and push it onto the output vector.
+ *
+ * The \a gids array is emptied by this call before any new values are added.
+ * Note that this routine fetches global IDs from the output mesh, not the input mesh;
+ * your entity handles must be from the output mesh.
+ * Also, be aware that many output entities will not have global IDs assigned;
+ * only those vertices which exist in the input mesh are guaranteed to have global IDs
+ * assigned to them -- vertices that only exist in the output mesh and all higher-dimensional
+ * output entities have no global IDs assigned until after a complete subdivision pass has been made.
+ *
+ * @param[in] ents An array of entities in the output mesh whose global IDs you desire
+ * @param[in] n The number of entities in the \a ents array.
+ * @param[out] gids A vector to contain the resulting global IDs.
+ * @retval A MOAB error code as supplied by the MBInterface::tag_get_data() call.
+ */
+int MBRefinerTagManager::get_output_gids( int n, const MBEntityHandle* ents, std::vector<int>& gids )
+{
+ int stat;
+ gids.clear();
+ for ( int i = 0; i < n; ++ i )
+ {
+ int gid = -1;
+ stat |= this->output_mesh->tag_get_data( this->tag_igid, ents + i, 1, &gid );
+ gids.push_back( gid );
+ }
+ return stat;
+}
+
+/**\brief Assign a global ID to an output entity.
+ *
+ * @param[in] ent The entity whose ID will be set
+ * @param[out] id The global ID
+ * @retval An error code as returned by MBInterface::tag_set_data().
+ */
+int MBRefinerTagManager::set_gid( MBEntityHandle ent, int gid )
+{
+ return this->output_mesh->tag_set_data( this->tag_ogid, &ent, 1, &gid );
+}
+
+/**\brief Set parallel status and sharing process list on an entity.
+ *
+ * This sets tag values for the PARALLEL_STATUS and one of PARALLEL_SHARED_PROC or PARALLEL_SHARED_PROCS tags
+ * if \a procs contains any processes (the current process is assumed <b>not</b> to be set in \a procs).
+ *
+ * @param[in] ent_handle The entity whose information will be set
+ * @param[in] procs The set of sharing processes.
+ */
+void MBRefinerTagManager::set_sharing( MBEntityHandle ent_handle, MBProcessSet& procs )
+{
+ int pstat;
+ if ( procs.get_process_members( this->rank, this->shared_procs_out ) )
+ pstat = PSTATUS_SHARED | PSTATUS_INTERFACE;
+ else
+ pstat = PSTATUS_SHARED | PSTATUS_INTERFACE | PSTATUS_NOT_OWNED;
+ if ( this->shared_procs_out[0] >= 0 )
+ {
+ // assert( MAX_SHARING_PROCS > 1 );
+ // Since get_process_members pads to MAX_SHARING_PROCS, this will be work:
+ if ( this->shared_procs_out[1] <= 0 )
+ {
+ //std::cout << " (proc )";
+ this->output_mesh->tag_set_data( this->tag_opsproc, &ent_handle, 1, &this->shared_procs_out[0] );
+ this->output_mesh->tag_set_data( this->tag_opstatus, &ent_handle, 1, &pstat );
+ }
+ else
+ {
+ //std::cout << " (procS)";
+ this->output_mesh->tag_set_data( this->tag_opsprocs, &ent_handle, 1, &this->shared_procs_out[0] );
+ this->output_mesh->tag_set_data( this->tag_opstatus, &ent_handle, 1, &pstat );
+ }
+ }
+ else
+ {
+ //std::cout << " (none )";
+ }
+ //std::cout << " new pstat: " << pstat << "\n";
+}
+
+/**\brief Determine the subset of processes which all share the specified entities.
+ *
+ * This is used to determine which processes an output entity should reside on when
+ * it is defined using several input entities (such as vertices).
+ */
+void MBRefinerTagManager::get_common_processes(
+ int num, const MBEntityHandle* src, MBProcessSet& common_shared_procs, bool on_output_mesh )
+{
+ MBInterface* mesh;
+ MBTag psproc;
+ MBTag psprocs;
+ if ( on_output_mesh )
+ {
+ mesh = this->output_mesh;
+ psproc = this->tag_opsproc;
+ psprocs = this->tag_opsprocs;
+ }
+ else
+ {
+ mesh = this->input_mesh;
+ psproc = this->tag_ipsproc;
+ psprocs = this->tag_ipsprocs;
+ }
+ bool first_ent = true;
+ common_shared_procs.clear();
+ for ( int i = 0; i < num; ++ i )
+ {
+ MBEntityHandle ent_in = src[i];
+ //std::cout << "<(" << ent_in << ")>";
+ int stat;
+ bool got = false;
+ this->current_shared_procs.clear();
+ stat = mesh->tag_get_data( psproc, &ent_in, 1, &this->shared_procs_in[0] );
+ if ( stat == MB_SUCCESS && this->shared_procs_in[0] != -1 )
+ {
+ got = true;
+ //std::cout << " s" << this->rank << " s" << this->shared_procs_in[0] << " | ";
+ this->shared_procs_in[1] = -1;
+ }
+ stat = mesh->tag_get_data( psprocs, &ent_in, 1, &this->shared_procs_in[0] );
+ if ( stat == MB_SUCCESS && this->shared_procs_in[0] != -1 )
+ {
+ got = true;
+ int i;
+ /*
+ for ( i = 0; i < MAX_SHARING_PROCS && this->shared_procs_in[i] != -1; ++ i )
+ std::cout << " m" << this->shared_procs_in[i];
+ std::cout << " | ";
+ */
+ }
+ if ( got )
+ {
+ this->current_shared_procs.set_process_members( this->shared_procs_in );
+ this->current_shared_procs.set_process_member( this->rank );
+ if ( first_ent )
+ {
+ common_shared_procs.unite( this->current_shared_procs );
+ first_ent = false;
+ }
+ else
+ {
+ common_shared_procs.intersect( this->current_shared_procs );
+ }
+ }
+ else
+ {
+ //std::cout << " not shared | ";
+ }
+ }
+ std::cout << " Common procs " << common_shared_procs;
+ std::cout << "\n";
+}
+
Modified: MOAB/trunk/refiner/MBRefinerTagManager.hpp
===================================================================
--- MOAB/trunk/refiner/MBRefinerTagManager.hpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBRefinerTagManager.hpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -28,6 +28,8 @@
#include "MBTypes.h" // for MB_DLL_EXPORT
+#include "MBProcessSet.hpp"
+
#include <vector>
class MBInterface;
@@ -51,21 +53,39 @@
MBInterface* get_input_mesh() { return this->input_mesh; }
MBInterface* get_output_mesh() { return this->output_mesh; }
- MBTag parallel_status() { return this->tag_pstatus; }
- MBTag shared_proc() { return this->tag_psproc; }
- MBTag shared_procs() { return this->tag_psprocs; }
+ MBTag input_parallel_status() { return this->tag_ipstatus; }
+ MBTag input_shared_proc() { return this->tag_ipsproc; }
+ MBTag input_shared_procs() { return this->tag_ipsprocs; }
+ int get_input_gids( int n, const MBEntityHandle* ents, std::vector<int>& gids );
+ int get_output_gids( int n, const MBEntityHandle* ents, std::vector<int>& gids );
+ int set_gid( MBEntityHandle ent, int gid );
+
+ void set_sharing( MBEntityHandle ent_handle, MBProcessSet& procs );
+ void get_common_processes( int num, const MBEntityHandle* src, MBProcessSet& common_shared_procs, bool on_output_mesh = true );
+
protected:
std::vector< std::pair< MBTag, int > > input_vertex_tags;
std::vector< std::pair< MBTag, int > > output_vertex_tags;
int vertex_size;
MBInterface* input_mesh;
MBInterface* output_mesh;
- MBTag tag_pstatus; // Handle for PARALLEL_STATUS on mesh_in
- MBTag tag_psprocs; // Handle for PARALLEL_SHARED_PROCS on mesh_in
- MBTag tag_psproc; // Handle for PARALLEL_SHARED_PROC on mesh_in
- MBTag tag_pshands; // Handle for PARALLEL_SHARED_HANDLES on mesh_in
- MBTag tag_pshand; // Handle for PARALLEL_SHARED_HANDLE on mesh_in
+ MBTag tag_ipstatus; // Handle for PARALLEL_STATUS on mesh_in
+ MBTag tag_ipsprocs; // Handle for PARALLEL_SHARED_PROCS on mesh_in
+ MBTag tag_ipsproc; // Handle for PARALLEL_SHARED_PROC on mesh_in
+ MBTag tag_ipshands; // Handle for PARALLEL_SHARED_HANDLES on mesh_in
+ MBTag tag_ipshand; // Handle for PARALLEL_SHARED_HANDLE on mesh_in
+ MBTag tag_igid; // Handle for global IDs on mesh_in
+ MBTag tag_opstatus; // Handle for PARALLEL_STATUS on mesh_out
+ MBTag tag_opsprocs; // Handle for PARALLEL_SHARED_PROCS on mesh_out
+ MBTag tag_opsproc; // Handle for PARALLEL_SHARED_PROC on mesh_out
+ MBTag tag_opshands; // Handle for PARALLEL_SHARED_HANDLES on mesh_out
+ MBTag tag_opshand; // Handle for PARALLEL_SHARED_HANDLE on mesh_out
+ MBTag tag_ogid; // Handle for global IDs on mesh_out
+ int rank;
+ std::vector<int> shared_procs_in; // Used to hold procs sharing an input vert.
+ std::vector<int> shared_procs_out; // Used to hold procs sharing an output entity.
+ MBProcessSet current_shared_procs; // Holds process list as it is being accumulated
};
#endif // MB_REFINERTAGMANAGER_H
Modified: MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp
===================================================================
--- MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -30,6 +30,7 @@
this->corner_coords.resize( 6 * 8 ); // Hex has 8 verts w/ 6 coordinates each
this->corner_tags.resize( 8 ); // Hex has 8 verts (this is a pointer, not the actual tag data)
this->corner_handles.resize( 8 ); // Hex has 8 verts (this is a pointer, not actual hash data)
+ this->input_is_output = false; // Until we know better
}
/// Empty destructor for good form.
@@ -61,7 +62,6 @@
void* tag_data;
for ( int n = 0; n < num_nodes; ++ n )
{
- this->corner_handles[n] = conn[n];
if ( imesh->get_coords( &conn[n], 1, &corner_coords[6 * n + 3] ) != MB_SUCCESS )
{
return false;
@@ -75,6 +75,20 @@
return false;
}
}
+ if ( this->input_is_output )
+ {
+ this->corner_handles[n] = conn[n];
+ }
+ else
+ {
+ this->corner_handles[n] = this->output_functor->map_vertex( conn[n], &corner_coords[6 * n], tag_data );
+#if 0
+ std::cout << "#+# " << this->corner_handles[n] << " < "
+ << corner_coords[ 6 * n + 3 ] << ", "
+ << corner_coords[ 6 * n + 4 ] << ", "
+ << corner_coords[ 6 * n + 5 ] << ">\n";
+#endif // 0
+ }
this->corner_tags[n] = tag_data;
}
@@ -170,6 +184,7 @@
{
this->tag_manager = tmgr;
this->tag_assigner->set_tag_manager( tmgr );
+ this->input_is_output = ( this->tag_manager->get_input_mesh() == this->tag_manager->get_output_mesh() );
//this->tag_assigner->set_edge_size_evaluator( this->edge_size_evaluator );
return this->MBEntityRefiner::prepare( tmgr, ofunc );
}
Modified: MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp
===================================================================
--- MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBSimplexTemplateRefiner.hpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -56,6 +56,7 @@
std::vector<double> corner_coords;
std::vector<void*> corner_tags;
std::vector<MBEntityHandle> corner_handles;
+ bool input_is_output;
static int template_index[64][2];
static int permutations_from_index[24][14];
Modified: MOAB/trunk/refiner/MBSplitVertices.cpp
===================================================================
--- MOAB/trunk/refiner/MBSplitVertices.cpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBSplitVertices.cpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -6,115 +6,10 @@
MBSplitVerticesBase::MBSplitVerticesBase( MBRefinerTagManager* tag_mgr )
{
this->tag_manager = tag_mgr;
- this->mesh_in = tag_mgr->get_input_mesh();
this->mesh_out = tag_mgr->get_output_mesh();
- this->shared_procs_in.resize( MAX_SHARING_PROCS );
- MBParallelComm* ipcomm = MBParallelComm::get_pcomm( this->mesh_in, 0 );
- this->rank = ipcomm ? ipcomm->proc_config().proc_rank() : 0;
- int zero = 0;
- MBErrorCode result = this->mesh_out->tag_create(
- GLOBAL_ID_TAG_NAME, sizeof(int), MB_TAG_DENSE, MB_TYPE_INTEGER, this->tag_gid, &zero, true );
- if ( result != MB_SUCCESS && result != MB_ALREADY_ALLOCATED )
- return;
}
MBSplitVerticesBase::~MBSplitVerticesBase()
{
}
-/// Determine which processes will contain an output vertex given the split vertices defining it.
-void MBSplitVerticesBase::update_partition_counts(
- int num, const MBEntityHandle* split_src, std::map<MBProcessSet,int>& proc_partition_counts )
-{
- this->begin_vertex_procs();
- for ( int i = 0; i < num; ++ i )
- {
- this->add_vertex_procs( split_src[i] );
- }
- this->end_vertex_procs();
- proc_partition_counts[this->common_shared_procs]++;
-}
-
-/// Prepare to compute the processes on which a new split-vertex will live.
-void MBSplitVerticesBase::begin_vertex_procs()
-{
- this->first_vertex = true;
- this->common_shared_procs.clear();
-}
-
-/// Call this for each existing corner vertex used to define a split-vertex.
-void MBSplitVerticesBase::add_vertex_procs( MBEntityHandle vert_in )
-{
- int stat;
- bool got = false;
- this->current_shared_procs.clear();
- stat = this->mesh_in->tag_get_data(
- this->tag_manager->shared_proc(), &vert_in, 1, &this->shared_procs_in[0] );
- if ( stat == MB_SUCCESS && this->shared_procs_in[0] != -1 )
- {
- got = true;
- std::cout << " s" << this->rank << " s" << this->shared_procs_in[0] << " | ";
- this->shared_procs_in[1] = -1;
- }
- stat = this->mesh_in->tag_get_data(
- this->tag_manager->shared_procs(), &vert_in, 1, &this->shared_procs_in[0] );
- if ( stat == MB_SUCCESS && this->shared_procs_in[0] != -1 )
- {
- got = true;
- int i;
- for ( i = 0; i < MAX_SHARING_PROCS && this->shared_procs_in[i] != -1; ++ i )
- std::cout << " m" << this->shared_procs_in[i];
- std::cout << " | ";
- }
- if ( got )
- {
- this->current_shared_procs.set_process_members( this->shared_procs_in );
- this->current_shared_procs.set_process_member( this->rank );
- if ( this->first_vertex )
- {
- this->common_shared_procs.unite( this->current_shared_procs );
- this->first_vertex = false;
- }
- else
- {
- this->common_shared_procs.intersect( this->current_shared_procs );
- }
- }
- else
- {
- std::cout << " not shared | ";
- }
-}
-
-/// Call this once after all the add_vertex_procs() calls for a split-vertex to prepare queues for the second stage MPI send.
-void MBSplitVerticesBase::end_vertex_procs()
-{
- std::cout << " Common procs " << this->common_shared_procs;
- std::cout << "\n";
- // FIXME: Here is where we add the vertex to the appropriate queues.
-}
-
-void MBSplitVerticesBase::set_sharing( MBEntityHandle ent_handle, MBProcessSet& procs )
-{
- int pstat;
- if ( procs.get_process_members( this->rank, this->shared_procs_out ) )
- pstat = PSTATUS_SHARED | PSTATUS_INTERFACE;
- else
- pstat = PSTATUS_SHARED | PSTATUS_INTERFACE | PSTATUS_NOT_OWNED;
- int sps = this->shared_procs_out.size();
- std::cout << " new pstat: " << pstat << " sps: " << sps << "\n";
- switch ( sps )
- {
- case 0:
- break;
- case 1:
- this->mesh_out->tag_set_data( this->tag_manager->shared_proc(), &ent_handle, 1, &this->shared_procs_out[0] );
- this->mesh_out->tag_set_data( this->tag_manager->parallel_status(), &ent_handle, 1, &pstat );
- break;
- default:
- this->mesh_out->tag_set_data( this->tag_manager->shared_procs(), &ent_handle, sps, &this->shared_procs_out[0] );
- this->mesh_out->tag_set_data( this->tag_manager->parallel_status(), &ent_handle, 1, &pstat );
- break;
- }
-}
-
Modified: MOAB/trunk/refiner/MBSplitVertices.hpp
===================================================================
--- MOAB/trunk/refiner/MBSplitVertices.hpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/MBSplitVertices.hpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -90,40 +90,18 @@
virtual bool find_or_create(
const MBEntityHandle* split_src, const double* coords, MBEntityHandle& vert_handle,
- std::map<MBProcessSet,int>& proc_partition_counts ) = 0;
+ std::map<MBProcessSet,int>& proc_partition_counts, bool handles_on_output_mesh ) = 0;
virtual bool create_element(
- const MBEntityHandle* split_src, MBEntityHandle& elem_handle,
+ MBEntityType etyp, int nconn, const MBEntityHandle* elem_verts, MBEntityHandle& elem_handle,
std::map<MBProcessSet,int>& proc_partition_counts ) = 0;
virtual void assign_global_ids( std::map<MBProcessSet,int>& gids ) = 0;
- /// Determine which processes will contain an output vertex given the split vertices defining it.
- void update_partition_counts( int num, const MBEntityHandle* split_src, std::map<MBProcessSet,int>& proc_partition_counts );
-
- /// Prepare to compute the processes on which a new split-vertex will live.
- void begin_vertex_procs();
-
- /// Call this for each existing corner vertex used to define a split-vertex.
- void add_vertex_procs( MBEntityHandle vert_in );
-
- /// Call this once after all the add_vertex_procs() calls for a split-vertex to prepare queues for the second stage MPI send.
- void end_vertex_procs();
-
- /// Set the tags which indicate sharing process(es) for an entity.
- void set_sharing( MBEntityHandle vert_handle, MBProcessSet& procs );
-
- MBInterface* mesh_in; // Input mesh. Needed to determine tag values on split_src verts
MBInterface* mesh_out; // Output mesh. Needed for new vertex set in vert_handle
MBRefinerTagManager* tag_manager;
- std::vector<int> shared_procs_in; // Used to hold procs sharing an input vert.
- std::vector<int> shared_procs_out; // Used to hold procs sharing an output vert.
std::vector<int> split_gids; // Used to hold global IDs of split vertices
- MBProcessSet current_shared_procs; // Holds process list as it is being accumulated
MBProcessSet common_shared_procs; // Holds intersection of several shared_procs_ins.
- int rank; // This process' rank.
- bool first_vertex; // True just after begin_vertex_procs() is called.
- MBTag tag_gid;
};
/** A map from a set of pre-existing entities to a new mesh entity.
@@ -143,9 +121,9 @@
virtual ~MBSplitVertices();
virtual bool find_or_create(
const MBEntityHandle* split_src, const double* coords, MBEntityHandle& vert_handle,
- std::map<MBProcessSet,int>& proc_partition_counts );
+ std::map<MBProcessSet,int>& proc_partition_counts, bool handles_on_output_mesh );
virtual bool create_element(
- const MBEntityHandle* split_src, MBEntityHandle& elem_handle,
+ MBEntityType etyp, int nconn, const MBEntityHandle* split_src, MBEntityHandle& elem_handle,
std::map<MBProcessSet,int>& proc_partition_counts );
virtual void assign_global_ids( std::map<MBProcessSet,int>& gids );
@@ -156,7 +134,6 @@
MBSplitVertices<_n>::MBSplitVertices( MBRefinerTagManager* tag_mgr )
: MBSplitVerticesBase( tag_mgr )
{
- this->shared_procs_in.resize( _n * MAX_SHARING_PROCS );
this->split_gids.resize( _n );
}
@@ -168,28 +145,32 @@
template< int _n >
bool MBSplitVertices<_n>::find_or_create(
const MBEntityHandle* split_src, const double* coords, MBEntityHandle& vert_handle,
- std::map<MBProcessSet,int>& proc_partition_counts )
+ std::map<MBProcessSet,int>& proc_partition_counts, bool handles_on_output_mesh )
{
// Get the global IDs of the input vertices
int stat;
- for ( int i = 0; i < _n; ++ i )
+ if ( handles_on_output_mesh )
{
- int gid = -1;
- stat = this->mesh_in->tag_get_data( this->tag_gid, split_src + i, 1, &gid );
- this->split_gids[i] = gid;
+ stat = this->tag_manager->get_output_gids( _n, split_src, this->split_gids );
}
+ else
+ {
+ stat = this->tag_manager->get_input_gids( _n, split_src, this->split_gids );
+ }
MBSplitVertexIndex<_n> key( &this->split_gids[0] );
MapIteratorType it = this->find( key );
if ( it == this->end() )
{
- this->update_partition_counts( _n, split_src, proc_partition_counts );
+ std::cout << " wrt output: " << handles_on_output_mesh << " ";
+ this->tag_manager->get_common_processes( _n, split_src, this->common_shared_procs, handles_on_output_mesh );
+ proc_partition_counts[this->common_shared_procs]++;
key.set_common_processes( this->common_shared_procs );
- if ( this->mesh_out->create_vertex( coords, vert_handle ) != MB_SUCCESS )
+ if ( this->mesh_out->create_vertex( coords + 3, vert_handle ) != MB_SUCCESS )
{
return false;
}
(*this)[key] = vert_handle;
- this->set_sharing( vert_handle, this->common_shared_procs );
+ this->tag_manager->set_sharing( vert_handle, this->common_shared_procs );
return true;
}
vert_handle = it->second;
@@ -198,9 +179,23 @@
template< int _n >
bool MBSplitVertices<_n>::create_element(
- const MBEntityHandle* split_src, MBEntityHandle& elem_handle,
+ MBEntityType etyp, int nconn, const MBEntityHandle* elem_verts, MBEntityHandle& elem_handle,
std::map<MBProcessSet,int>& proc_partition_counts )
{
+ // Get the global IDs of the input vertices
+ int stat;
+ stat = this->tag_manager->get_input_gids( _n, elem_verts, this->split_gids );
+ MBSplitVertexIndex<_n> key( &this->split_gids[0] );
+ this->tag_manager->get_common_processes( _n, elem_verts, this->common_shared_procs );
+ proc_partition_counts[this->common_shared_procs]++;
+ key.set_common_processes( this->common_shared_procs );
+ if ( this->mesh_out->create_element( etyp, elem_verts, nconn, elem_handle ) != MB_SUCCESS )
+ {
+ return false;
+ }
+ (*this)[key] = elem_handle;
+ this->tag_manager->set_sharing( elem_handle, this->common_shared_procs );
+ return true;
}
template< int _n >
@@ -210,8 +205,8 @@
for ( it = this->begin(); it != this->end(); ++ it )
{
int gid = gids[it->first.process_set] ++;
- this->mesh_out->tag_set_data( this->tag_gid, &it->second, 1, &gid );
- std::cout << "Assigning " << it->first << " -> " << gid << "\n";
+ this->tag_manager->set_gid( it->second, gid );
+ std::cout << "Assigning entity: " << it->first << " GID: " << gid << "\n";
}
}
Modified: MOAB/trunk/refiner/test_mesh_refiner.cpp
===================================================================
--- MOAB/trunk/refiner/test_mesh_refiner.cpp 2008-08-18 17:28:19 UTC (rev 2047)
+++ MOAB/trunk/refiner/test_mesh_refiner.cpp 2008-08-25 23:02:57 UTC (rev 2048)
@@ -30,7 +30,7 @@
//sleep(20);
// Create the input mesh and, if -new-mesh is specified, an output mesh
- const char* ifname = argc > 1 ? argv[1] : "/home/dcthomp/fourVolsBare.cub";
+ const char* ifname = argc > 1 ? argv[1] : "fourVolsBare.cub";
bool input_is_output = ( argc > 2 && ! strcmp( argv[2], "-new-mesh" ) ) ? false : true;
MBInterface* imesh = new MBCore( rank, nprocs );
MBInterface* omesh = input_is_output ? imesh : new MBCore( rank, nprocs );
@@ -41,25 +41,10 @@
ReadParallel* readpar = new ReadParallel( imesh, ipcomm );
#endif // USE_MPI
- // Get the global ID tag so we can set things up for resolve_shared_ents
- //MBTag tag_gid;
- //imesh->tag_create( PARALLEL_GID_TAG_NAME, sizeof( int ), MB_TAG_DENSE, MB_TYPE_INTEGER, tag_gid, default_gid );
-
-#ifdef USE_MPI
- // Get tags for the various data-distributed mesh annotations
- MBTag tag_sproc;
- MBTag tag_sprocs;
- MBTag tag_shand;
- MBTag tag_shands;
- MBTag tag_pstat;
- ipcomm->get_shared_proc_tags( tag_sproc, tag_sprocs, tag_shand, tag_shands, tag_pstat );
- MBTag tag_part = ipcomm->partition_tag();
-#endif // USE_MPI
-
MBEntityHandle set_handle;
std::ostringstream parallel_options;
parallel_options
- << "PARALLEL=BCAST_DELETE" << ";" // NB: You can also use READ_DELETE here.
+ << "PARALLEL=BCAST_DELETE" << ";" // NB: You can use BCAST_DELETE or READ_DELETE here.
<< "PARTITION=MATERIAL_SET" << ";"
//<< "PARTITION_DISTRIBUTE" << ";"
<< "PARTITION_VAL=" << ( rank + 1 ) << ";"
@@ -83,6 +68,9 @@
imesh->load_file( ifname, set_handle, parallel_options.str().c_str() );
imesh->list_entities( 0, 1 );
#endif // USE_MPI
+ std::ostringstream ifs;
+ ifs << "prerefiner." << nprocs << "." << rank << ".vtk";
+ imesh->write_mesh( ifs.str().c_str() );
// The refiner will need an implicit function to be used as an indicator function for subdivision:
MBEdgeSizeSimpleImplicit* eval = new MBEdgeSizeSimpleImplicit();
@@ -96,9 +84,13 @@
// (We don't add tag_gid to the refiner's tag manager because it is special)
eref->set_edge_size_evaluator( eval );
MBRange ents_to_refine;
- ents_to_refine.insert( set_handle );
+ imesh->get_entities_by_type( set_handle, MBTET, ents_to_refine ); // refine just the tets
+ //ents_to_refine.insert( set_handle ); // refine everything multiple times (because subsets are not disjoint)
mref->refine( ents_to_refine );
+ std::ostringstream ofs;
+ ofs << "refiner." << nprocs << "." << rank << ".vtk";
+ omesh->write_mesh( ofs.str().c_str() );
// Print out the results, one process at a time
#ifdef USE_MPI
for ( int i = 0; i < nprocs; ++ i )
1
0