Commit fa59a2c1 authored by Kirill Terekhov's avatar Kirill Terekhov

Cleanup and fixes

Removed local ctest configuration and one example.

Modified stencil expression and variable for more comfortable use.

Replaced code of newer C++ standard in xml.cpp.

Modified functions for adjacency retrieval to accept private markers in
parallel shared run.
parent 7ff26906
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
##
## # The following are required to submit to the CDash dashboard:
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "inmost")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "localhost")
set(CTEST_DROP_LOCATION "/cdash/submit.php?project=inmost")
set(CTEST_DROP_SITE_CDASH TRUE)
......@@ -6,6 +6,5 @@ add_subdirectory(GridGen)
add_subdirectory(FVDiscr)
add_subdirectory(ADFVDiscr)
add_subdirectory(ADMFD)
#add_subdirectory(NMPFA)
#add_subdirectory(OctreeCutcell)
add_subdirectory(Solver)
project(NMPFA)
set(SOURCE main.cpp)
add_executable(NMPFA ${SOURCE})
target_link_libraries(NMPFA inmost)
if(USE_SOLVER)
if(USE_SOLVER_ANI)
message("linking NMPFA with ani3d and BLAS")
target_link_libraries(NMPFA ani3d ${BLAS_LIBRARIES})
if(BLAS_LINKER_FLAGS)
set_target_properties(NMPFA PROPERTIES LINK_FLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
if(USE_SOLVER_PETSC)
message("linking NMPFA with PETSc")
target_link_libraries(NMPFA ${PETSC_LIBRARIES})
endif()
if(USE_SOLVER_TRILINOS)
message("linking NMPFA with Trilinos")
target_link_libraries(NMPFA ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES})
endif()
if(USE_SOLVER_METIS)
message("linking NMPFA with Metis")
target_link_libraries(NMPFA ${METIS_LIBRARIES})
endif()
if(USE_SOLVER_MONDRIAAN)
message("linking NMPFA with Mondriaan")
target_link_libraries(NMPFA ${MONDRIAAN_LIBRARIES})
endif()
if(USE_SOLVER_SUPERLU)
message("linking NMPFA with SuperLU")
target_link_libraries(NMPFA ${SUPERLU_LIBRARIES})
endif()
endif()
if(USE_PARTITIONER)
if(USE_PARTITIONER_ZOLTAN)
message("linking NMPFA with Zoltan")
target_link_libraries(NMPFA ${ZOLTAN_LIBRARIES})
endif()
if(USE_PARTITIONER_PARMETIS)
message("linking NMPFA with ParMETIS")
target_link_libraries(NMPFA ${PARMETIS_LIBRARIES})
endif()
endif()
if(USE_MPI)
message("linking NMPFA with MPI")
target_link_libraries(NMPFA ${MPI_LIBRARIES})
if(MPI_LINK_FLAGS)
set_target_properties(NMPFA PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS NMPFA EXPORT inmost-targets RUNTIME DESTINATION bin)
This diff is collapsed.
......@@ -16,7 +16,9 @@
// 1. expression templates for operations
// (???) how to for multiplication?
// 2. (ok) template matrix type for AD variables
// 3. template container type for data storage.
// 4. option for wrapper container around provided data storage. (to perform matrix operations with existing data)
// 5. class Subset for fortran-like access to matrix.
namespace INMOST
{
......
......@@ -19,6 +19,9 @@
// 5. Consider optimization by checking zero variation multipliers, check that assembly do not degrade.
// 6. floor, ceil, atan, acos, asin, max, min functions
// 7. choice of directional derivatives at discontinuities for abs, pow, max, min (see ADOL-C)
// 8. replace stencil with foreach for provided iterators
// 9. enclose in namespace
#ifdef _MSC_VER
#pragma warning(disable : 4503)
#endif
......@@ -1293,36 +1296,36 @@ namespace INMOST
template<class A>
class stencil_expression : public shell_expression<stencil_expression<A> >
{
dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 > arg;
dynarray< const_multiplication_expression<A>, 64 > arg;
INMOST_DATA_REAL_TYPE value;
public:
stencil_expression(const dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 > & parg) : arg(parg)
stencil_expression(const dynarray< const_multiplication_expression<A>, 64 > & parg) : arg(parg)
{
value = 0.0;
for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
value += it->first * it->second.GetValue();
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
value += it->GetValue();
}
stencil_expression(const stencil_expression & other) : arg(other.arg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
it->second.GetJacobian(it->first*mult,r);
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
it->GetJacobian(mult,r);
}
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{
for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
it->second.GetJacobian(it->first*mult,r);
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
it->GetJacobian(mult,r);
}
__INLINE void GetHessian(INMOST_DATA_REAL_TYPE multJ, Sparse::Row & J, INMOST_DATA_REAL_TYPE multH, Sparse::HessianRow & H) const
{
Sparse::Row tmpJ, curJ;
Sparse::HessianRow tmpH, curH;
for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
{
curJ.Clear();
curH.Clear();
it->second.GetHessian(it->first*multJ,curJ,it->first*multH,curH);
it->GetHessian(multJ,curJ,multH,curH);
Sparse::Row::MergeSortedRows(1.0,curJ,1.0,J,tmpJ);
Sparse::HessianRow::MergeSortedRows(1.0,curH,1.0,H,tmpH);
J.Swap(tmpJ);
......@@ -1539,5 +1542,6 @@ template<class A> __INLINE INMOST::function_expression<
__INLINE INMOST_DATA_REAL_TYPE get_table(INMOST_DATA_REAL_TYPE Arg, const INMOST::keyval_table & Table) {return Table.GetValue(Arg);}
#endif
#endif
......@@ -23,6 +23,7 @@
// 5. Consider optimization by checking zero variation multipliers, check that assembly do not degrade.
// 6. Document everything
// 7. change stencil_variable with foreach_variable and introduce function foreach(iterator beg, iterator end, arg)
// 8. enclose in namespace
//This should stop Visual Studio from complaining of very long auto-generated class types
#ifdef _MSC_VER
......@@ -360,14 +361,13 @@ namespace INMOST
class stencil_variable : public shell_dynamic_variable< stencil_expression<typename A::Var>, stencil_variable<A> >
{
private:
Automatizator & aut;
INMOST_DATA_ENUM_TYPE stnclind;
Tag tag_elems;
Tag tag_coefs;
const A & Arg;
void * user_data;
public:
stencil_variable(Automatizator & paut, INMOST_DATA_ENUM_TYPE pstnclind, const shell_dynamic_variable<typename A::Var,A> & parg, void * puser_data = NULL) : aut(paut), stnclind(pstnclind), Arg(parg), user_data(puser_data) {}
stencil_variable(const stencil_variable & other) : aut(other.aut), stnclind(other.stnclind), Arg(other.Arg), user_data(other.user_data) {}
stencil_variable & operator =(const stencil_variable & other) {aut = other.aut; stnclind = other.stnclind; Arg = other.Arg; user_data = other.user_data; return * this;}
stencil_variable(Tag tag_elems, Tag tag_coefs, const shell_dynamic_variable<typename A::Var,A> & parg) : tag_elems(tag_elems), tag_coefs(tag_coefs), Arg(parg) {}
stencil_variable(const stencil_variable & other) : tag_elems(other.tag_elems), tag_coefs(other.tag_coefs), Arg(other.Arg) {}
stencil_variable & operator =(const stencil_variable & other) {tag_elems = other.tag_elems; tag_coefs = other.tag_coefs; Arg = other.Arg; return * this;}
INMOST_DATA_REAL_TYPE Value(const Storage & e) const {return (*this)[e].GetValue();}
multivar_expression Variable(const Storage & e) const
{
......@@ -376,12 +376,13 @@ namespace INMOST
}
stencil_expression<typename A::Var> operator [](const Storage & e) const
{
dynarray<std::pair<INMOST_DATA_REAL_TYPE, typename A::Var>, 64> tmp;
Automatizator::stencil_pairs stncl;
aut.GetStencil(stnclind, e, user_data, stncl);
tmp.resize(stncl.size());
for(INMOST_DATA_ENUM_TYPE k = 0; k < stncl.size(); ++k)
tmp[k] = std::make_pair(stncl[k].first, Arg[stncl[k].second]);
dynarray< const_multiplication_expression<typename A::Var>, 64> tmp;
Storage::real_array coefs = e.RealArray(tag_coefs);
Storage::reference_array elems = e.RealArray(tag_elems);
assert(coefs.size() == elems.size());
tmp.resize(elems.size());
for(INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k)
tmp[k] = const_multiplication_expression<A>(Arg[elems[k]],coefs[k]);
return stencil_expression<typename A::Var>(tmp);
}
void GetVariation(const Storage & e, Sparse::Row & r) const { (*this)[e].GetJacobian(1.0,r); }
......@@ -527,7 +528,9 @@ namespace INMOST
typedef abstract_dynamic_variable abstract_variable;
}
template<class A, class B, class C> __INLINE INMOST::ternary_custom_variable<INMOST::condition_expression<typename A::Var, typename B::Var, typename C::Var>,A,B,C> condition(INMOST::shell_dynamic_variable<typename A::Var, A> const & control, INMOST::shell_dynamic_variable<typename B::Var, B> const & if_ge_zero, INMOST::shell_dynamic_variable<typename C::Var, C> const & if_lt_zero) { return INMOST::ternary_custom_variable<INMOST::condition_expression<typename A::Var, typename B::Var, typename C::Var>,A,B,C>(control,if_ge_zero,if_lt_zero); }
template<class A, class B, class C>
__INLINE
INMOST::ternary_custom_variable<INMOST::condition_expression<typename A::Var, typename B::Var, typename C::Var>,A,B,C> condition(INMOST::shell_dynamic_variable<typename A::Var, A> const & control, INMOST::shell_dynamic_variable<typename B::Var, B> const & if_ge_zero, INMOST::shell_dynamic_variable<typename C::Var, C> const & if_lt_zero) { return INMOST::ternary_custom_variable<INMOST::condition_expression<typename A::Var, typename B::Var, typename C::Var>,A,B,C>(control,if_ge_zero,if_lt_zero); }
template<class A> __INLINE INMOST::unary_custom_variable<INMOST::unary_minus_expression<typename A::Var>,A> operator-(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg) { return INMOST::unary_custom_variable<INMOST::unary_minus_expression<typename A::Var>,A>(Arg); }
template<class A> __INLINE INMOST::unary_custom_variable<INMOST::abs_expression<typename A::Var>,A> fabs(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg) { return INMOST::unary_custom_variable<INMOST::abs_expression<typename A::Var>,A>(Arg); }
template<class A> __INLINE INMOST::unary_custom_variable<INMOST::exp_expression<typename A::Var>,A> exp(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg) { return INMOST::unary_custom_variable<INMOST::exp_expression<typename A::Var>,A>(Arg); }
......@@ -551,10 +554,17 @@ template<class B> __INLINE INMOST::unary_const_c
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A> operator+(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A>(Left,Right); }
template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_subtraction_expression<typename B::Var>,B> operator-(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_subtraction_expression<typename B::Var>,B>(Right, Left); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A> operator-(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A>(Left, -Right); }
template<class A> __INLINE INMOST::stencil_variable<A> stencil(INMOST::Automatizator & aut, INMOST_DATA_ENUM_TYPE stncl, INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg, void * user_data = NULL) { return INMOST::stencil_variable<A>(aut,stncl,Arg,user_data); }
template<class A> __INLINE INMOST::stencil_variable<A> stencil(INMOST::Tag tag_elems, INMOST::Tag tag_coefs, INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg) { return INMOST::stencil_variable<A>(tag_elems,tag_coefs,Arg); }
template<class A> __INLINE INMOST::table_variable<A> get_table(INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg, const INMOST::keyval_table & Table) {return INMOST::table_variable<A>(Arg,Table);}
template<class A> __INLINE INMOST::stencil_expression<A> stencil(INMOST::HandleType * elems, INMOST_DATA_REAL_TYPE * coefs, INMOST_DATA_ENUM_TYPE num, INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg)
{
INMOST::dynarray< INMOST::const_multiplication_expression<typename A::Var>, 64> tmp;
for( INMOST_DATA_ENUM_TYPE k = 0; k < num; ++k) if( elems[k] != 0 )
tmp.push_back(INMOST::const_multiplication_expression<typename A::Var>(Arg[elems[k]],coefs[k]));
return INMOST::stencil_expression<typename A::Var>(tmp);
}
......
This diff is collapsed.
......@@ -81,15 +81,31 @@ namespace INMOST
if( !m->HideMarker() )
{
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetMarker(lc[it],mask) ) aret.push_back(lc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetPrivateMarker(lc[it],mask) ) aret.push_back(lc[it]);
}
else
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetMarker(lc[it],mask) ) aret.push_back(lc[it]);
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
}
else
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
}
}
return aret;
}
......@@ -123,15 +139,31 @@ namespace INMOST
if( !m->HideMarker() )
{
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) ) aret.push_back(hc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(hc[it],mask)) ) aret.push_back(hc[it]);
}
else
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) ) aret.push_back(hc[it]);
}
}
else
{
MarkerType hm = GetMeshLink()->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
}
else
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
}
}
return aret;
}
......@@ -172,7 +204,7 @@ namespace INMOST
}
}
for(ElementArray<Cell>::size_type it = 0; it < aret.size(); it++)
m->RemPrivateMarker(aret.at(it),mrk);
m->RemPrivateMarker(aret.at(it),mrk);
m->ReleasePrivateMarker(mrk);
return aret;
}
......@@ -182,39 +214,73 @@ namespace INMOST
assert(GetHandleElementType(GetHandle())==EDGE);
Mesh * m = GetMeshLink();
ElementArray<Cell> aret(m);
MarkerType mrk = m->CreatePrivateMarker();
if( !GetMeshLink()->HideMarker() )
if( isPrivate(mask) )
{
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) //faces
if( !GetMeshLink()->HideMarker() )
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) //cels
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk) )
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) //faces
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) //cels
if( (invert ^ m->GetPrivateMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk) )
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !m->GetMarker(hc[it],hm) ) //faces
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !m->GetMarker(ihc[jt],hm) ) //cels
if( (invert ^ m->GetPrivateMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk) )
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !m->GetMarker(hc[it],hm) ) //faces
if( !GetMeshLink()->HideMarker() )
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !m->GetMarker(ihc[jt],hm) ) //cels
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk) )
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) //faces
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) //cels
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk) )
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !m->GetMarker(hc[it],hm) ) //faces
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !m->GetMarker(ihc[jt],hm) ) //cels
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk) )
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
}
for(ElementArray<Cell>::size_type it = 0; it < aret.size(); it++)
m->RemPrivateMarker(aret.at(it),mrk);
m->RemPrivateMarker(aret.at(it),mrk);
m->ReleasePrivateMarker(mrk);
return aret;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -29,18 +29,33 @@ namespace INMOST
assert(GetHandleElementType(GetHandle())==NODE);
Mesh * m = GetMeshLink();
ElementArray<Edge> aret(m);
adj_type const & hc = m->HighConn(GetHandle());
if( !m->HideMarker() )
{
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( invert ^ m->GetMarker(hc[it],mask) ) aret.push_back(hc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( invert ^ m->GetPrivateMarker(hc[it],mask) ) aret.push_back(hc[it]);
}
else
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( invert ^ m->GetMarker(hc[it],mask) ) aret.push_back(hc[it]);
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
}
else
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
}
}
return aret;
}
......@@ -91,33 +106,68 @@ namespace INMOST
Mesh * m = GetMeshLink();
ElementArray<Face> aret(m);
MarkerType mrk = m->CreatePrivateMarker();
if( !m->HideMarker() )
if( isPrivate(mask) )
{
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) //edges
if( !m->HideMarker() )
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) //faces
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk))
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) //edges
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) //faces
if( (invert ^ m->GetPrivateMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk))
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !m->GetMarker(hc[it],hm) )//edges
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !m->GetMarker(ihc[jt],hm) ) //faces
if( (invert ^ m->GetPrivateMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk))
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !m->GetMarker(hc[it],hm) )//edges
if( !m->HideMarker() )
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !m->GetMarker(ihc[jt],hm) ) //faces
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk))
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) //edges
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) //faces
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk))
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !m->GetMarker(hc[it],hm) )//edges
{
adj_type const & ihc = m->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !m->GetMarker(ihc[jt],hm) ) //faces
if( (invert ^ m->GetMarker(ihc[jt],mask)) && !m->GetPrivateMarker(ihc[jt],mrk))
{
aret.push_back(ihc[jt]);
m->SetPrivateMarker(ihc[jt],mrk);
}
}
}
}
for(ElementArray<Face>::size_type it = 0; it < aret.size(); it++) m->RemMarker(aret.at(it),mrk);
......@@ -150,22 +200,33 @@ namespace INMOST
assert(GetHandleElementType(GetHandle())==NODE);
Mesh * m = GetMeshLink();
ElementArray<Cell> aret(m);
adj_type const & lc = m->LowConn(GetHandle());
if( !m->HideMarker() )
{
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); ++it)
{
bool mrk = m->GetMarker(lc[it],mask);
bool test = invert ^ mrk;
if( test ) aret.push_back(lc[it]);
}
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetPrivateMarker(lc[it],mask) ) aret.push_back(lc[it]);
}
else
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetMarker(lc[it],mask) ) aret.push_back(lc[it]);
}
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
}
else
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
}
}
return aret;
}
......
......@@ -1511,9 +1511,9 @@ namespace INMOST
else if( t.RawData() )
{
std::string data = ReadUntil("<"); //read until next tag opening
data.pop_back(); //drop '<'
data.resize(data.size()-1); //drop '<'
//remove trailing spaces
while( !data.empty() && isspace(data.back()) ) data.pop_back();
while( !data.empty() && isspace(data[data.size()-1]) ) data.resize(data.size()-1);
if( verbose )
{
Report("info: encountered raw data, %s",data.c_str());
......@@ -1526,9 +1526,7 @@ namespace INMOST
else if( t.BlockData() )
{
std::string data = ReadUntil("]]>");
data.pop_back(); //drop '>'
data.pop_back(); //drop ']'
data.pop_back(); //drop ']'
data.resize(data.size()-3); //drop ]]>
if( verbose )
{
Report("info: encountered block data, %s",data.c_str());
......
......@@ -25,6 +25,7 @@ set(INMOST_LIBRARIES inmost)
set(USE_MPI @USE_MPI@)
set(USE_OMP @USE_OMP@)
set(USE_PARTITIONER_ZOLTAN @USE_PARTITIONER_ZOLTAN@)
set(USE_PARTITIONER_PARMETIS @USE_PARTITIONER_PARMETIS@)
set(USE_SOLVER_MONDRIAAN @USE_SOLVER_MONDRIAAN@)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment