Commit 4727e73e authored by Gilles MARCKMANN's avatar Gilles MARCKMANN

xFEM:

- Mark xFEM/xAttachableXXX class as deprecated (they shall be moved or removed).

xGeom:

- change use of xAttachableChar : replace const unsigned int tag_nodes  by a const xAttachedDataManagerAOMD<char>& in constructor of xLevelSetToCGALAndTag.

xTLS:

- change use of xAttachableChar : replace const unsigned int tag_nodes by a xAttachedDataManagerAOMD<char> in:
		- TLSGeomInterfaceSignedVectorLevelSet,
		- reInitLevelSetFromFrontCGAL2,
		- xEvalTLSAdimLSFromLevelSetAndLCFront
		- xRefCutToIsoCGAL
parent 826905a8
......@@ -17,7 +17,6 @@
#include "xApplyCommandOnIntegrationRule.h"
#include "xAssembler.h"
#include "xAttachableEntitiesVector.h"
#include "xCommandOnGeomElem.h"
#include "xDebug.h"
#include "xEntityToEntity.h"
......
/*
/*
This file is a part of eXlibris C++ Library
under the GNU Lesser General Public License.
See the NOTICE.md & LICENSE.md files for terms
See the NOTICE.md & LICENSE.md files for terms
and conditions.
*/
#ifndef ___XCHARCONTAINER_H
#define ___XCHARCONTAINER_H
#include "mEntity.h"
#include "mAttachableDataContainer.h"
#include "mEntity.h"
namespace xfem
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableChar class ///////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableChar class
//////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class xAttachableChar : public AOMD::mAttachableData {
public:
~xAttachableChar() override= default;
// public methodes ///////////////
// public members ////////////////
char c;
class xAttachableChar : public AOMD::mAttachableData
{
public:
xAttachableChar() __attribute__((deprecated)) = default;
~xAttachableChar() override = default;
// public methodes ///////////////
// public members ////////////////
char c;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableChar class ///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableChar class
//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO
// see if it's the right place for these functions
// TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO ---
// TODO --- TODO --- TODO see if it's the right place for these functions
// get attached data of type xAttachableChar
inline char getAttachedChar(const AOMD::mEntity* e, unsigned int tag) {
xAttachableChar *ac = (xAttachableChar *)(e->getData(tag));
if(!ac)return 0;
return ac->c;
// get attached data of type xAttachableChar
char getAttachedChar(const AOMD::mEntity* e, unsigned int tag) __attribute__((deprecated));
inline char getAttachedChar(const AOMD::mEntity* e, unsigned int tag)
{
xAttachableChar* ac = (xAttachableChar*)(e->getData(tag));
if (!ac) return 0;
return ac->c;
}
// set attached data of type xAttachableChar
inline void attachChar(AOMD::mEntity* e,unsigned int tag, char c)
// set attached data of type xAttachableChar
void attachChar(AOMD::mEntity* e, unsigned int tag, char c) __attribute__((deprecated));
inline void attachChar(AOMD::mEntity* e, unsigned int tag, char c)
{
xAttachableChar *ac = (xAttachableChar *)(e->getData(tag));
if(!ac)
{
ac = new xAttachableChar;
e->attachData(tag,ac);
}
ac->c = c;
xAttachableChar* ac = (xAttachableChar*)(e->getData(tag));
if (!ac)
{
ac = new xAttachableChar;
e->attachData(tag, ac);
}
ac->c = c;
}
// TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO
// TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO --- TODO ---
// TODO --- TODO --- TODO
} // end of namespace
} // namespace xfem
#endif
/*
/*
This file is a part of eXlibris C++ Library
under the GNU Lesser General Public License.
See the NOTICE.md & LICENSE.md files for terms
See the NOTICE.md & LICENSE.md files for terms
and conditions.
*/
#ifndef ___XENTITIESSETCONTAINER_H
#define ___XENTITIESSETCONTAINER_H
#include <set>
#include "mEntity.h"
#include "mAttachableDataContainer.h"
#include "mAttachableDataContainer.h"
#include "mEntity.h"
namespace xfem
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableEntitiesSet class ///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableEntitiesSet class
//////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class xAttachableEntitiesSet : public AOMD::mAttachableData {
public:
~xAttachableEntitiesSet() override= default;
// public methodes ///////////////
// public members ////////////////
std::set<AOMD::mEntity *> vect;
class xAttachableEntitiesSet : public AOMD::mAttachableData
{
public:
xAttachableEntitiesSet() __attribute__((deprecated)) = default;
~xAttachableEntitiesSet() override = default;
// public methodes ///////////////
// public members ////////////////
std::set<AOMD::mEntity *> vect;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableEntitiesSet class ///////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableEntitiesSet class
//////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// get attached data of type xAttachableEntitiesSet
inline std::set<AOMD::mEntity *>* getAttachedEntitiesSet(AOMD::mEntity* e, unsigned int tag) {
xAttachableEntitiesSet *av = (xAttachableEntitiesSet *)(e->getData(tag));
if(!av)return nullptr;
return &(av->vect);
}
// set attached data of type xAttachableEntitiesSet
inline void attachEntitiesSet(AOMD::mEntity* e,unsigned int tag, std::set<AOMD::mEntity *> & v)
std::set<AOMD::mEntity *> *getAttachedEntitiesSet(AOMD::mEntity *e, unsigned int tag) __attribute__((deprecated));
inline std::set<AOMD::mEntity *> *getAttachedEntitiesSet(AOMD::mEntity *e, unsigned int tag)
{
xAttachableEntitiesSet *av = (xAttachableEntitiesSet *)(e->getData(tag));
if(!av)
{
av = new xAttachableEntitiesSet;
e->attachData(tag,av);
}
(av->vect).insert(v.begin(), v.end());
xAttachableEntitiesSet *av = (xAttachableEntitiesSet *)(e->getData(tag));
if (!av) return nullptr;
return &(av->vect);
}
} // end of namespace
// set attached data of type
void xAttachableEntitiesSetvoid attachEntitiesSet(AOMD::mEntity *e, unsigned int tag, std::set<AOMD::mEntity *> &v)
__attribute__((deprecated));
{
inline void attachEntitiesSet(AOMD::mEntity * e, unsigned int tag, std::set<AOMD::mEntity *> &v)
{
xAttachableEntitiesSet *av = (xAttachableEntitiesSet *)(e->getData(tag));
if (!av)
{
av = new xAttachableEntitiesSet;
e->attachData(tag, av);
}
(av->vect).insert(v.begin(), v.end());
}
} // end of namespace
#endif
/*
/*
This file is a part of eXlibris C++ Library
under the GNU Lesser General Public License.
See the NOTICE.md & LICENSE.md files for terms
See the NOTICE.md & LICENSE.md files for terms
and conditions.
*/
#ifndef ___XENTITIESVECTORCONTAINER_H
#define ___XENTITIESVECTORCONTAINER_H
#include <vector>
#include "mEntity.h"
#include "mAttachableDataContainer.h"
#include "mAttachableDataContainer.h"
#include "mEntity.h"
namespace xfem
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableEntitiesVector class ////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableEntitiesVector class
///////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class xAttachableEntitiesVector : public AOMD::mAttachableData {
public:
~xAttachableEntitiesVector() override= default;
// public methodes ///////////////
// public members ////////////////
std::vector<AOMD::mEntity *> vect;
class xAttachableEntitiesVector : public AOMD::mAttachableData
{
public:
xAttachableEntitiesVector() __attribute__((deprecated)) = default;
~xAttachableEntitiesVector() override = default;
// public methodes ///////////////
// public members ////////////////
std::vector<AOMD::mEntity *> vect;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableEntitiesVector class ////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableEntitiesVector class
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// get attached data of type xAttachableEntitiesVector
inline std::vector<AOMD::mEntity *>* getAttachedEntitiesVector(AOMD::mEntity* e, unsigned int tag) {
xAttachableEntitiesVector *av = (xAttachableEntitiesVector *)(e->getData(tag));
if(!av)return nullptr;
return &(av->vect);
std::vector<AOMD::mEntity *> *getAttachedEntitiesVector(AOMD::mEntity *e, unsigned int tag) __attribute__((deprecated));
inline std::vector<AOMD::mEntity *> *getAttachedEntitiesVector(AOMD::mEntity *e, unsigned int tag)
{
xAttachableEntitiesVector *av = (xAttachableEntitiesVector *)(e->getData(tag));
if (!av) return nullptr;
return &(av->vect);
}
// set attached data of type xAttachableEntitiesVector
inline void attachEntitiesVector(AOMD::mEntity* e,unsigned int tag, std::vector<AOMD::mEntity *> & v)
{
xAttachableEntitiesVector *av = (xAttachableEntitiesVector *)(e->getData(tag));
if(!av)
{
av = new xAttachableEntitiesVector;
e->attachData(tag,av);
}
(av->vect).resize(v.size());
std::copy(v.begin(), v.end(), (av->vect).begin());
void attachEntitiesVector(AOMD::mEntity *e, unsigned int tag, std::vector<AOMD::mEntity *> &v) __attribute__((deprecated));
inline void attachEntitiesVector(AOMD::mEntity *e, unsigned int tag, std::vector<AOMD::mEntity *> &v)
{
xAttachableEntitiesVector *av = (xAttachableEntitiesVector *)(e->getData(tag));
if (!av)
{
av = new xAttachableEntitiesVector;
e->attachData(tag, av);
}
(av->vect).resize(v.size());
std::copy(v.begin(), v.end(), (av->vect).begin());
}
} // end of namespace
} // namespace xfem
#endif
......@@ -21,8 +21,7 @@ class xAttachableGaussPoints : public AOMD::mAttachableData
public:
typedef std::vector<std::pair<xtensor::xPoint, double>> Container;
typedef Container::iterator Iter;
xAttachableGaussPoints() {}
xAttachableGaussPoints() __attribute__((deprecated)) = default;
Container gauss_points;
};
......
/*
/*
This file is a part of eXlibris C++ Library
under the GNU Lesser General Public License.
See the NOTICE.md & LICENSE.md files for terms
See the NOTICE.md & LICENSE.md files for terms
and conditions.
*/
......@@ -15,35 +15,34 @@
namespace AOMD
{
class mEntity;
class mEntity;
}
namespace xfem
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableString class ////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// xAttachableString class
///////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class xAttachableString : public AOMD::mAttachableData
{
public:
~xAttachableString() override= default;
std::string s;
class xAttachableString : public AOMD::mAttachableData
{
public:
xAttachableString() __attribute__((deprecated)) = default;
~xAttachableString() override = default;
std::string s;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableString class ////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// End xAttachableString class
///////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// get attached data of type xAttachableString
std::string & getAttachedString(AOMD::mEntity* e, unsigned int tag);
// set attached data of type xAttachableString
void attachString(AOMD::mEntity* e,unsigned int tag, const std::string & s);
// get attached data of type xAttachableString
std::string& getAttachedString(AOMD::mEntity* e, unsigned int tag) __attribute__((deprecated));
// set attached data of type xAttachableString
void attachString(AOMD::mEntity* e, unsigned int tag, const std::string& s) __attribute__((deprecated));
} // end of namespace
} // namespace xfem
#endif
......@@ -11,7 +11,7 @@
// geom
#include "xDistanceNearestPointGenerator.h"
// xfem
#include "xAttachableChar.h"
#include "xLevelSet.h"
#include "xLevelSetOperators.h"
// AOMD
......@@ -36,7 +36,9 @@ namespace xgeom
/////////////////////////////////////// Constructor
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef HAVE_CGAL
xLevelSetToCGALAndTag::xLevelSetToCGALAndTag(xfem::xLevelSet &ls_, const unsigned int tag_nodes_, bool fit, double fittol)
xLevelSetToCGALAndTag::xLevelSetToCGALAndTag(xfem::xLevelSet &ls_,
const xinterface::aomd::xAttachedDataManagerAOMD<char> &tag_nodes_, bool fit,
double fittol)
: refcut(xcut::xRefCutToIsoZeroVector()), ls(ls_), tagger(tag_nodes_)
{
if (fit)
......@@ -45,17 +47,22 @@ xLevelSetToCGALAndTag::xLevelSetToCGALAndTag(xfem::xLevelSet &ls_, const unsigne
ls.accept(fit);
}
}
xLevelSetTriToCGALEdgeAndTag::xLevelSetTriToCGALEdgeAndTag(xfem::xLevelSet &ls_, const unsigned int tag_nodes_, bool fit,
double fittol)
xLevelSetTriToCGALEdgeAndTag::xLevelSetTriToCGALEdgeAndTag(xfem::xLevelSet &ls_,
const xinterface::aomd::xAttachedDataManagerAOMD<char> &tag_nodes_,
bool fit, double fittol)
: xLevelSetToCGALAndTag(ls_, tag_nodes_, fit, fittol), cut_points(6)
{
}
xLevelSetTetToCGALTriAndTag::xLevelSetTetToCGALTriAndTag(xfem::xLevelSet &ls_, const unsigned int tag_nodes_, bool fit,
double fittol)
xLevelSetTetToCGALTriAndTag::xLevelSetTetToCGALTriAndTag(xfem::xLevelSet &ls_,
const xinterface::aomd::xAttachedDataManagerAOMD<char> &tag_nodes_,
bool fit, double fittol)
: xLevelSetToCGALAndTag(ls_, tag_nodes_, fit, fittol), cut_points(12)
{
}
xLevelSetToCGALAndTag::tagNode::tagNode(const unsigned int tag_nodes_) : tag_nodes(tag_nodes_) {}
xLevelSetToCGALAndTag::tagNode::tagNode(const xinterface::aomd::xAttachedDataManagerAOMD<char> &tag_nodes_)
: tag_nodes(tag_nodes_)
{
}
#endif
/////////////////////////////////////// End constructor
......@@ -70,7 +77,8 @@ xLevelSetToCGALAndTag::tagNode::tagNode(const unsigned int tag_nodes_) : tag_nod
#ifdef HAVE_CGAL
void xLevelSetToCGALAndTag::tagNode::operator()(mEntity *e) const
{
attachChar(e, tag_nodes, 1);
// attachChar(e, tag_nodes, 1);
const_cast<xinterface::aomd::xAttachedDataManagerAOMD<char> &>(tag_nodes).setData(*e) = 1;
return;
}
......
......@@ -20,6 +20,8 @@
#include <CGAL/Simple_cartesian.h>
// geom
#include "AABBPrimitiveExtention.h"
// interface
#include "xAttachedDataManagerAOMD.h"
#endif
#ifdef HAVE_ANN
......@@ -57,6 +59,8 @@ class xRefCutToIsoZeroVector;
}
#endif
//#define HAVE_CGAL
namespace xgeom
{
#ifdef HAVE_AOMD
......@@ -190,15 +194,16 @@ struct xAOMDTriToCGALTri
class xLevelSetToCGALAndTag
{
protected:
xLevelSetToCGALAndTag(xfem::xLevelSet& ls_, const unsigned int tag_nodes_, bool fit, double fittol);
xLevelSetToCGALAndTag(xfem::xLevelSet& ls_, const xinterface::aomd::xAttachedDataManagerAOMD<char>& tag_nodes_, bool fit,
double fittol);
class tagNode
{
public:
tagNode(const unsigned int tag_nodes_);
tagNode(const xinterface::aomd::xAttachedDataManagerAOMD<char>& tag_nodes_);
void operator()(AOMD::mEntity* e) const;
private:
const unsigned int tag_nodes;
const xinterface::aomd::xAttachedDataManagerAOMD<char>& tag_nodes;
};
const xcut::xRefCutToIsoZeroVector& refcut;
xfem::xLevelSet& ls;
......@@ -227,7 +232,8 @@ class xLevelSetTriToCGALEdgeAndTag : private xLevelSetToCGALAndTag
typedef Container_t::iterator Iterator_t;
typedef CGAL::AABB_segment_primitive<Kernel_t, Iterator_t> Primitive_t;
xLevelSetTriToCGALEdgeAndTag(xfem::xLevelSet& ls_, const unsigned int tag_nodes_, bool fit = true, double fittol = 1.e-2);
xLevelSetTriToCGALEdgeAndTag(xfem::xLevelSet& ls_, const xinterface::aomd::xAttachedDataManagerAOMD<char>& tag_nodes_,
bool fit = true, double fittol = 1.e-2);
// mandatory for xDistanceNearestPoint class
void generateEntity(EntityArg_t entity_, Container_t& entity_res_list_) const;
......@@ -276,7 +282,8 @@ class xLevelSetTetToCGALTriAndTag : private xLevelSetToCGALAndTag
typedef Container_t::iterator Iterator_t;
typedef CGAL::AABB_triangle_primitive<Kernel_t, Iterator_t> Primitive_t;
xLevelSetTetToCGALTriAndTag(xfem::xLevelSet& ls_, const unsigned int tag_nodes_, bool fit = true, double fittol = 1.e-2);
xLevelSetTetToCGALTriAndTag(xfem::xLevelSet& ls_, const xinterface::aomd::xAttachedDataManagerAOMD<char>& tag_nodes_,
bool fit = true, double fittol = 1.e-2);
void generateEntity(EntityArg_t entity_, Container_t& entity_res_list_) const;
......
......@@ -45,7 +45,6 @@ TLSGeomInterfaceSignedVectorLevelSet::TLSGeomInterfaceSignedVectorLevelSet(int d
domain(nullptr),
domain_def(nullptr),
pmesh(nullptr),
tag_nodes(0),
update_count(0),
vid(xVertexIDGeneratorSingleton::instance()),
getsupport(dim)
......@@ -229,10 +228,12 @@ void TLSGeomInterfaceSignedVectorLevelSet::updateDomain(const xMesh *mesh, xLeve
const xMesh *bnd = physsurf_ls_0->getIsoZeroMesh();
if (bnd->size(0))
{
// previous implementation :
// fake tag for construction
std::ostringstream oss;
oss << "tag_nodes_not_used_TLSGeomInterfaceSignedVectorLevelSet_" << this;
tag_nodes = AOMD_Util::Instance()->lookupMeshDataId(oss.str().c_str());
// std::ostringstream oss;
// oss << "tag_nodes_not_used_TLSGeomInterfaceSignedVectorLevelSet_" << this;
// tag_nodes = AOMD_Util::Instance()->lookupMeshDataId(oss.str().c_str());
// Now, tag_nodes is a xAttachedDataManagerAOMD<char> which does nor need a tag
// construct svls from ls and generate associated physical surface
switch (dim)
......
......@@ -127,7 +127,7 @@ class TLSGeomInterfaceSignedVectorLevelSet : public TLSGeomInterface
xcut::xPhysDomain *domain;
xcut::xPhysDomain::domain_container_t *domain_def;
xfem::xMesh *pmesh;
unsigned int tag_nodes;
xinterface::aomd::xAttachedDataManagerAOMD<char> tag_nodes;
int update_count; // count update for debug output : to be removed
xcut::xVertexIDGenerator &vid;
......
......@@ -31,7 +31,6 @@
#include "mEntityContainer.h"
#include "mVertex.h"
#include "xAttachableChar.h"
#include "xDistanceNearestPoint.h"
#include "xDistanceNearestPointGenerator.h"
#include "xRefCutToCGAL.h"
......@@ -288,8 +287,9 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
const double zero = 0.;
xtensor::xPoint vertex_point;
std::ostringstream oss;
oss << "tag_nodes_reInitLevelSetFromFrontCGAL2_" << this;
const unsigned int tag_nodes = AOMD_Util::Instance()->lookupMeshDataId(oss.str().c_str());
xinterface::aomd::xAttachedDataManagerAOMD<char> tag_nodes_reInitLevelSetFromFrontCGAL2;
// oss << "tag_nodes_reInitLevelSetFromFrontCGAL2_" << this;
// const unsigned int tag_nodes = AOMD_Util::Instance()->lookupMeshDataId(oss.str().c_str());
if (target.dim() == 3)
{
......@@ -298,7 +298,7 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
std::list<Triangle> triangles;
xTetRefCutToIsoCGAL cutter(ls, tag_nodes, triangles);
xTetRefCutToIsoCGAL cutter(ls, tag_nodes_reInitLevelSetFromFrontCGAL2, triangles);
for_each(target.begin(), target.end(), cutter);
if (!triangles.size()) return;
......@@ -330,7 +330,8 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
ls(*it) = -d;
}
// reset tag
attachChar(*it, tag_nodes, 0);
tag_nodes_reInitLevelSetFromFrontCGAL2.setData(*(*it)) = 0;
// attachChar(*it, tag_nodes_reInitLevelSetFromFrontCGAL2, 0);
++it;
}
}
......@@ -339,7 +340,8 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
while (it != end)
{
mEntity *e = *it;
if (!getAttachedChar(e, tag_nodes))
if (!tag_nodes_reInitLevelSetFromFrontCGAL2.getData(*e))
// if (!getAttachedChar(e, tag_nodes))
{
vertex_point = ((mVertex *)e)->point();
Point point_query(vertex_point(0), vertex_point(1), vertex_point(2));
......@@ -354,7 +356,8 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
}
// reset tag
attachChar(e, tag_nodes, 0);
// attachChar(e, tag_nodes, 0);
tag_nodes_reInitLevelSetFromFrontCGAL2.setData(*e) = 0;
}
++it;
}
......@@ -367,7 +370,7 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
std::list<Segment> segments;
xTriRefCutToIsoCGAL cutter(ls, tag_nodes, segments);
xTriRefCutToIsoCGAL cutter(ls, tag_nodes_reInitLevelSetFromFrontCGAL2, segments);
for_each(target.begin(), target.end(), cutter);
if (!segments.size()) return;
......@@ -399,7 +402,8 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
ls(*it) = -d;
}
// reset tag
attachChar(*it, tag_nodes, 0);
// attachChar(*it, tag_nodes_reInitLevelSetFromFrontCGAL2, 0);
tag_nodes_reInitLevelSetFromFrontCGAL2.setData(*(*it)) = 0;
++it;
}
}
......@@ -408,7 +412,8 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
while (it != end)
{
mEntity *e = *it;
if (!getAttachedChar(e, tag_nodes))
// if (!getAttachedChar(e, tag_nodes))
if (!tag_nodes_reInitLevelSetFromFrontCGAL2.getData(*e))
{
vertex_point = ((mVertex *)e)->point();
Point point_query(vertex_point(0), vertex_point(1), vertex_point(2));
......@@ -423,7 +428,8 @@ void reInitLevelSetFromFrontCGAL2::visit(xLevelSet &ls, xRegion target)
}
// reset tag
attachChar(e, tag_nodes, 0);
// attachChar(e, tag_nodes, 0);
tag_nodes_reInitLevelSetFromFrontCGAL2.setData(*e) = 0;
}
++it;
}
......@@ -439,14 +445,15 @@ void reInitLevelSetFromFrontCGAL3::visit(xLevelSet &ls, xRegion target)
const double zero = 0.;
xtensor::xPoint vertex_point;
std::ostringstream oss;
oss << "tag_nodes_reInitLevelSetFromFrontCGAL3_" << this;
const unsigned int tag_nodes = AOMD_Util::Instance()->lookupMeshDataId(oss.str().c_str());
// oss << "tag_nodes_reInitLevelSetFromFrontCGAL3_" << this;
// const unsigned int tag_nodes = AOMD_Util::Instance()->lookupMeshDataId(oss.str().c_str());
xinterface::aomd::xAttachedDataManagerAOMD<char> tag_nodes_reInitLevelSetFromFrontCGAL3;
xIter it = target.begin(0);
xIter end = target.end(0);
if (target.dim() == 3)
{
xLevelSetTetToCGALTriAndTag generator(ls, tag_nodes);
xLevelSetTetToCGALTriAndTag generator(ls, tag_nodes_reInitLevelSetFromFrontCGAL3);
xDistanceNearestPoint<xIter, xLevelSetTetToCGALTriAndTag> distance_nearest_point(target.begin(), target.end(), generator,
target.getPartitionManager().getComm());
......@@ -456,7 +463,8 @@ void reInitLevelSetFromFrontCGAL3::visit(xLevelSet &ls, xRegion target)
while (it != end)
{
mEntity *e = *it;
if (!getAttachedChar(e, tag_nodes))
// if (!getAttachedChar(e, tag_nodes))
if (!tag_nodes_reInitLevelSetFromFrontCGAL3.getData(*e))
{
d = distance_nearest_point.distance((mVertex *)e);
if (ls(e) >= 0.)
......@@ -466,13 +474,14 @@ void reInitLevelSetFromFrontCGAL3::visit(xLevelSet &ls, xRegion target)
}
else
// reset tag
attachChar(e, tag_nodes, 0);
// attachChar(e, tag_nodes_reInitLevelSetFromFrontCGAL3, 0);
tag_nodes_reInitLevelSetFromFrontCGAL3.setData(*e) = 0;
++it;
}
}
else
{
xLevelSetTriToCGALEdgeAndTag generator(ls, tag_nodes);
xLevelSetTriToCGALEdgeAndTag generator(ls, tag_nodes_reInitLevelSetFromFrontCGAL3);
xDistanceNearestPoint<xIter, xLevelSetTriToCGALEdgeAndTag> distance_nearest_point(target.begin(), target.end(), generator,
target.getPartitionManager().getComm());
......@@ -482,7 +491,8 @@ void reInitLevelSetFromFrontCGAL3::visit(xLevelSet &ls, xRegion target)
while (it != end)
{
mEntity *e = *it;
if (!getAttachedChar(e, tag_nodes))
// if (!getAttachedChar(e, tag_nodes))
if (!tag_nodes_reInitLevelSetFromFrontCGAL3.getData(*e))
{
d = distance_nearest_point.distance((mVertex *)e);
if (ls(e) >= 0.)
......@@ -492,7 +502,8 @@ void reInitLevelSetFromFrontCGAL3::visit(xLevelSet &ls, xRegion target)
}
else
// reset tag
attachChar(e, tag_nodes, 0);
// attachChar(e, tag_nodes, 0);
tag_nodes_reInitLevelSetFromFrontCGAL3.setData(*e) = 0;
++it;
}
}
......
......@@ -30,7 +30,6 @@
#include "mEntityContainer.h"
#include "mVertex.h"
#include "xAttachableChar.h"
#include "xDistanceNearestPoint.h"
#include "xDistanceNearestPointGenerator.h"
#include "xRefCutToCGAL.h"
......
......@@ -7,7 +7,6 @@
#include "xEvalTLSAdimLS.h"
// xfem
#include "xAttachableChar.h"
#include "xMesh.h"
using namespace xfem;
......@@ -30,8 +29,10 @@ double xEvalTLSAdimLSFromLevelSet::getGrad() const { return one_on_lc; }
//-------------------------------------------------------------------------------------------------------------------------------------------------
xEvalTLSAdimLSFromLevelSetAndLCFront::xEvalTLSAdimLSFromLevelSetAndLCFront(
xLevelSet &l, const double &lc_, const std::function<void(AOMD::mEntity *, xPartition &)> &get_partition, const xMesh *iso_lc,
bool iso_not_empty_, xfem::xEntityToEntity upper_)
: ls(l), upper(upper_), lc(lc_), one_on_lc(1. / lc_), iso_not_empty(iso_not_empty_)
bool iso_not_empty_,
// xtool::xGeneralUnorderedMapDataManager<AOMD::mEntity*, short>& _tagger_,
xinterface::aomd::xAttachedDataManagerAOMD<char> &_tagger_, xfem::xEntityToEntity upper_)
: ls(l), upper(upper_), lc(lc_), one_on_lc(1. / lc_), iso_not_empty(iso_not_empty_), tagger(_tagger_)
{
update(get_partition, iso_lc);
}
......@@ -39,19 +40,23 @@ xEvalTLSAdimLSFromLevelSetAndLCFront::xEvalTLSAdimLSFromLevelSetAndLCFront(
void xEvalTLSAdimLSFromLevelSetAndLCFront::update(const std::function<void(AOMD::mEntity *, xPartition &)> &get_partition,
const xMesh *iso_lc)
{
std::stringstream tag_name;
tag_name << "xEvalTLSAdimLSFromLevelSetAndLCFront"; // same name for all instance for persistance of the tag
tag = AOMD::AOMD_Util::Instance()->lookupMeshDataId(tag_name.str().c_str());
// std::stringstream tag_name;
// tag_name << "xEvalTLSAdimLSFromLevelSetAndLCFront"; // same name for all instance for persistance of the tag
// unsigned int tag = AOMD::AOMD_Util::Instance()->lookupMeshDataId(tag_name.str().c_str());
unsigned int tag = AOMD::AOMD_Util::Instance()->lookupMeshDataId("xEvalTLSAdimLSFromLevelSetAndLCFront");
// iso_lc mesh is not empty
if (iso_not_empty)
{
int dim = iso_lc->dim();