Commit 5f4ffd7b authored by Alexis SALZMAN's avatar Alexis SALZMAN

[xFEM,xCut] remove AOMD dependancy and friend to xSupportComponent class

In this commit xSupportComponent is no longer derived from attachable
model of AOMD. This make it more general.

In the same spirit the friend class xPhysDomain is removed. It was
intended to avoid some component creation in instance of
xSupportComponent by anything but xPhysDomain. Now the method is made
public and  xSupportComponent instance can be modified.

As this class is a key feature of future mesh tool chain this
generalization was mandatory to fit to : A block of the tool chain
provide a service to access support component via a functor that return
const xSupportComponent.

This functor type is now given by xSupportComponent.h header.(TODO
must replace some typdef in xDoubleCut)

xDoubleCut has to be modified accordingly. Now in xPhysDomain class
use of tag for xSupportComponent is replaced by
xAttachedDataManagerAOMDGeneric mechanism. Not that knowsupportcomponent
member is suppressed and its action treated via the new usage of
xAttachedDataManagerAOMDGeneric.
Note also that update with change of definition is now dealing
correctly with support (see dom5 in disk example which is now cleanly
updated)
parent 5d11f62f
This diff is collapsed.
......@@ -104,10 +104,6 @@ class xPhysDomain
typedef filter_container_t::iterator filter_container_it_t;
typedef std::vector<xPhysSurfCut::loader_t> loader_container_t;
typedef loader_container_t::iterator loader_container_it_t;
typedef std::unordered_multimap<AOMD::mEntity *, std::pair<size_t, char>, AOMD::EntityHashKey, AOMD::EntityEqualKey>
knowncomponent_t;
typedef knowncomponent_t::iterator knowncomponent_it_t;
typedef std::pair<knowncomponent_it_t, knowncomponent_it_t> knowncomponent_p_it_t;
// static private member data
static const char in_status, out_status, ocut_status, mcut_status, new_status, metric_status;
......@@ -120,7 +116,7 @@ class xPhysDomain
unsigned int filter_tag;
unsigned int dim;
const domain_container_t &domain_definition;
int dom_def_size;
size_t dom_def_size;
size_t nb_support_comp;
filter_container_t filters;
loader_container_t loaders;
......@@ -130,8 +126,8 @@ class xPhysDomain
std::vector<iso_domain_container_t> iso_elem;
std::vector<std::vector<size_t>> iso_elem_gen;
std::vector<bool> iso_is_gen;
std::vector<std::array<unsigned int, 2>> support_component_tag;
knowncomponent_t knowncomponent;
std::vector<std::array<xinterface::aomd::xAttachedDataManagerAOMDGeneric<AOMD::mEntity, xfem::xSupportComponent>, 2>>
support_component_container;
#ifdef WITH_MULTI_CUT
xgeom::xPolyIntersec intersector;
#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 XCUT_XPHYSDOMAIN_IMP_H
#define XCUT_XPHYSDOMAIN_IMP_H
namespace xcut {
template < typename MESHPHYS >
xPhysDomain::xPhysDomain(const MESHPHYS &mesh, const std::string &_name, const domain_container_t& domain_def, const xfem::xGetSupport & _getsupport, bool export_geom_ ) :
name(_name), getsupport(_getsupport)
,dim(mesh.size(3) != 0 ? 3 : ( mesh.size(2) != 0 ? 2 : ( ( mesh.size(1) != 0 ) ? 1 : 0 ) ))
,domain_definition(domain_def)
,dom_def_size(domain_definition.size())
,nb_support_comp(0)
,current(nullptr),mesher(dim),
iso_elem(dom_def_size), iso_elem_gen(dom_def_size),iso_is_gen(dom_def_size,false)
,export_geom(export_geom_),id_export(0),nb_newI(0),nb_newS(0)
namespace xcut
{
template <typename MESHPHYS>
xPhysDomain::xPhysDomain(const MESHPHYS &mesh, const std::string &_name, const domain_container_t &domain_def,
const xfem::xGetSupport &_getsupport, bool export_geom_)
: name(_name),
getsupport(_getsupport),
dim(mesh.size(3) != 0 ? 3 : (mesh.size(2) != 0 ? 2 : ((mesh.size(1) != 0) ? 1 : 0))),
domain_definition(domain_def),
dom_def_size(domain_definition.size()),
nb_support_comp(0),
current(nullptr),
mesher(dim),
iso_elem(dom_def_size),
iso_elem_gen(dom_def_size),
iso_is_gen(dom_def_size, false),
export_geom(export_geom_),
id_export(0),
nb_newI(0),
nb_newS(0)
{
// check dim
assert(dim > 1);
// check dim
assert(dim>1);
// check definition
assert(dom_def_size>0);
// check definition
assert(dom_def_size > 0);
// set tag
setTags();
// set tag
setTags();
// set filter
setFilter();
// set filter
setFilter();
// treatement of element
auto iteb = mesh.begin(dim);
auto itee = mesh.end(dim);
for (; iteb != itee; ++iteb)
setFilterTag(*iteb);
// treatement of element
auto iteb = mesh.begin(dim);
auto itee = mesh.end(dim);
for (; iteb != itee; ++iteb) setFilterTag(*iteb);
}
template < typename MESHPHYS >
void xPhysDomain::update(const MESHPHYS &mesh,bool new_domain_def, bool force_element_data_creation)
template <typename MESHPHYS>
void xPhysDomain::update(const MESHPHYS &mesh, bool new_domain_def, bool force_element_data_creation)
{
// check dim
assert((mesh.size(3) != 0 ? 3 : (mesh.size(2) != 0 ? 2 : ((mesh.size(1) != 0) ? 1 : 0))) == dim);
// check dim
assert((mesh.size(3) != 0 ? 3 : ( mesh.size(2) != 0 ? 2 : ( ( mesh.size(1) != 0 ) ? 1 : 0 ) ))==dim);
if (new_domain_def)
{
// TODO : support stuff to treate (new tag ...)
iso_is_gen.flip();
clearUpdatedIsoContainer();
dom_def_size=domain_definition.size();
assert(dom_def_size>0);
iso_is_gen.assign(dom_def_size,false);
iso_elem_gen.resize(dom_def_size);
iso_elem.resize(dom_def_size);
setFilter();
}
if (new_domain_def)
{
// TODO : support stuff may certainly be treated more efficiently
// The cleaning is an easy solution but reusing old support from old
// def would be more efficient. The problem is to seek for old def in new def
clearAllSupportComponent();
iso_is_gen.flip();
clearUpdatedIsoContainer();
dom_def_size = domain_definition.size();
assert(dom_def_size > 0);
support_component_container.resize(dom_def_size);
iso_is_gen.assign(dom_def_size, false);
iso_elem_gen.resize(dom_def_size);
iso_elem.resize(dom_def_size);
setFilter();
}
// treatement of element
auto iteb = mesh.begin(dim);
auto itee = mesh.end(dim);
if (force_element_data_creation)
{
xElemCutDomainData* dom_data;
for (; iteb != itee; ++iteb)
{
AOMD::mEntity *e=*iteb;
setFilterTag(e);
generateElemAndFinalStatus(e,&dom_data);
}
}
else
{
for (; iteb != itee; ++iteb)
setFilterTag(*iteb);
}
// treatement of element
auto iteb = mesh.begin(dim);
auto itee = mesh.end(dim);
if (force_element_data_creation)
{
xElemCutDomainData *dom_data;
for (; iteb != itee; ++iteb)
{
AOMD::mEntity *e = *iteb;
setFilterTag(e);
generateElemAndFinalStatus(e, &dom_data);
}
}
else
{
for (; iteb != itee; ++iteb) setFilterTag(*iteb);
}
// clean iso container
clearUpdatedIsoContainer();
// clean iso container
clearUpdatedIsoContainer();
return;
return;
}
} //end namespace xcut
} // end namespace xcut
#endif
......@@ -11,7 +11,6 @@
#include "xSupportComponent.h"
using namespace std;
using namespace AOMD;
namespace xfem
{
......@@ -47,6 +46,11 @@ void xSupportComponent::addComponent(const component &comp)
allcomponent.push_back(comp);
return;
}
void xSupportComponent::addComponentByMove(component &comp)
{
allcomponent.push_back(std::move(comp));
return;
}
void xSupportComponent::clear()
{
......
......@@ -8,7 +8,8 @@
#ifndef XFEM_XSUPPORTCOMPONENT_H
#define XFEM_XSUPPORTCOMPONENT_H
// stl
// std
#include <functional>
#include <vector>
// AOMD
......@@ -26,7 +27,7 @@ class xPhysDomain;
namespace xfem
{
class xSupportComponent : public AOMD::mAttachableData
class xSupportComponent
{
public:
typedef std::vector<const AOMD::mEntity *> component;
......@@ -40,16 +41,18 @@ class xSupportComponent : public AOMD::mAttachableData
component &getSplitZone();
void addComponent(const component &comp);
void addComponentByMove(component &comp);
void clear();
friend class xcut::xPhysDomain;
component &getNewComponent(size_t i);
private:
std::vector<component> allcomponent;
component split_zone;
component &getNewComponent(size_t i);
};
// a typedef to discribe functor that return a xSupportComponent from a entity
typedef std::function<const xfem::xSupportComponent &(AOMD::mEntity *)> getSupportComponent_functor_t;
} // end namespace xfem
#endif
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