fix append and SplitManifoldComponents when wedge text coords are enabled

This commit is contained in:
alemuntoni 2021-05-17 17:36:32 +02:00
parent 1ec2d65a58
commit c150c3f6b6
2 changed files with 200 additions and 383 deletions

View File

@ -689,6 +689,9 @@ public:
tmpMesh.vert.EnableVFAdjacency();
tmpMesh.face.EnableVFAdjacency();
if (m.face.IsWedgeTexCoordEnabled())
tmpMesh.face.EnableWedgeTexCoord();
size_t selCnt=0;
for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)

View File

@ -264,215 +264,7 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
tri::UpdateSelection<ConstMeshRight>::VertexFromFaceLoose(mr,true);
}
// phase 1. allocate on ml vert,edge,face, hedge to accomodat those of mr
// and build the remapping for all
Remap remap;
// vertex
remap.vert.resize(mr.vert.size(), Remap::InvalidIndex());
VertexIteratorLeft vp;
size_t svn = UpdateSelection<ConstMeshRight>::VertexCount(mr);
if(selected)
vp=Allocator<MeshLeft>::AddVertices(ml,int(svn));
else
vp=Allocator<MeshLeft>::AddVertices(ml,mr.vn);
for(VertexIteratorRight vi=mr.vert.begin(); vi!=mr.vert.end(); ++vi)
{
if(!(*vi).IsD() && (!selected || (*vi).IsS()))
{
size_t ind=Index(mr,*vi);
remap.vert[ind]=int(Index(ml,*vp));
++vp;
}
}
// edge
remap.edge.resize(mr.edge.size(), Remap::InvalidIndex());
EdgeIteratorLeft ep;
size_t sen = UpdateSelection<ConstMeshRight>::EdgeCount(mr);
if(selected) ep=Allocator<MeshLeft>::AddEdges(ml,sen);
else ep=Allocator<MeshLeft>::AddEdges(ml,mr.en);
for(EdgeIteratorRight ei=mr.edge.begin(); ei!=mr.edge.end(); ++ei)
if(!(*ei).IsD() && (!selected || (*ei).IsS())){
size_t ind=Index(mr,*ei);
remap.edge[ind]=int(Index(ml,*ep));
++ep;
}
// face
remap.face.resize(mr.face.size(), Remap::InvalidIndex());
FaceIteratorLeft fp;
size_t sfn = UpdateSelection<ConstMeshRight>::FaceCount(mr);
if(selected) fp=Allocator<MeshLeft>::AddFaces(ml,sfn);
else fp=Allocator<MeshLeft>::AddFaces(ml,mr.fn);
for(FaceIteratorRight fi=mr.face.begin(); fi!=mr.face.end(); ++fi)
if(!(*fi).IsD() && (!selected || (*fi).IsS())){
size_t ind=Index(mr,*fi);
remap.face[ind]=int(Index(ml,*fp));
++fp;
}
// hedge
remap.hedge.resize(mr.hedge.size(),Remap::InvalidIndex());
for(HEdgeIteratorRight hi=mr.hedge.begin(); hi!=mr.hedge.end(); ++hi)
if(!(*hi).IsD() && (!selected || (*hi).IsS())){
size_t ind=Index(mr,*hi);
assert(remap.hedge[ind]==Remap::InvalidIndex());
HEdgeIteratorLeft hp = Allocator<MeshLeft>::AddHEdges(ml,1);
(*hp).ImportData(*(hi));
remap.hedge[ind]=Index(ml,*hp);
}
remap.tetra.resize(mr.tetra.size(), Remap::InvalidIndex());
for (TetraIteratorRight ti = mr.tetra.begin(); ti != mr.tetra.end(); ++ti)
if (!(*ti).IsD() && (!selected || (*ti).IsS())) {
size_t idx = Index(mr, *ti);
assert (remap.tetra[idx] == Remap::InvalidIndex());
TetraIteratorLeft tp = Allocator<MeshLeft>::AddTetras(ml, 1);
(*tp).ImportData(*ti);
remap.tetra[idx] = Index(ml, *tp);
}
// phase 2.
// copy data from mr to its corresponding elements in ml and adjacencies
// vertex
for(VertexIteratorRight vi=mr.vert.begin();vi!=mr.vert.end();++vi)
if( !(*vi).IsD() && (!selected || (*vi).IsS())){
ml.vert[remap.vert[Index(mr,*vi)]].ImportData(*vi);
if(adjFlag) ImportVertexAdj(ml,mr,ml.vert[remap.vert[Index(mr,*vi)]],*vi,remap);
}
// edge
for(EdgeIteratorRight ei=mr.edge.begin();ei!=mr.edge.end();++ei)
if(!(*ei).IsD() && (!selected || (*ei).IsS())){
ml.edge[remap.edge[Index(mr,*ei)]].ImportData(*ei);
// Edge to Vertex Adj
EdgeLeft &el = ml.edge[remap.edge[Index(mr,*ei)]];
if(HasEVAdjacency(ml) && HasEVAdjacency(mr)){
el.V(0) = &ml.vert[remap.vert[Index(mr,ei->cV(0))]];
el.V(1) = &ml.vert[remap.vert[Index(mr,ei->cV(1))]];
}
if(adjFlag) ImportEdgeAdj(ml,mr,el,*ei,remap);
}
// face
const size_t textureOffset = ml.textures.size();
bool WTFlag = HasPerWedgeTexCoord(mr) && (textureOffset>0);
for(FaceIteratorRight fi=mr.face.begin();fi!=mr.face.end();++fi)
if(!(*fi).IsD() && (!selected || (*fi).IsS()))
{
FaceLeft &fl = ml.face[remap.face[Index(mr,*fi)]];
fl.Alloc(fi->VN());
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
for(int i = 0; i < fl.VN(); ++i)
fl.V(i) = &ml.vert[remap.vert[Index(mr,fi->cV(i))]];
}
fl.ImportData(*fi);
if(WTFlag)
for(int i = 0; i < fl.VN(); ++i)
fl.WT(i).n() += short(textureOffset);
if(adjFlag) ImportFaceAdj(ml,mr,ml.face[remap.face[Index(mr,*fi)]],*fi,remap);
}
// hedge
for(HEdgeIteratorRight hi=mr.hedge.begin();hi!=mr.hedge.end();++hi)
if(!(*hi).IsD() && (!selected || (*hi).IsS())){
ml.hedge[remap.hedge[Index(mr,*hi)]].ImportData(*hi);
ImportHEdgeAdj(ml,mr,ml.hedge[remap.hedge[Index(mr,*hi)]],*hi,remap,selected);
}
//tetra
for(TetraIteratorRight ti = mr.tetra.begin(); ti != mr.tetra.end(); ++ti)
if(!(*ti).IsD() && (!selected || (*ti).IsS()))
{
TetraLeft &tl = ml.tetra[remap.tetra[Index(mr,*ti)]];
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
for(int i = 0; i < 4; ++i)
tl.V(i) = &ml.vert[remap.vert[Index(mr,ti->cV(i))]];
}
tl.ImportData(*ti);
if(adjFlag) ImportTetraAdj(ml, mr, ml.tetra[remap.tetra[Index(mr,*ti)]], *ti, remap);
}
// phase 3.
// take care of other per mesh data: textures, attributes
// At the end concatenate the vector with texture names.
ml.textures.insert(ml.textures.end(),mr.textures.begin(),mr.textures.end());
// Attributes. Copy only those attributes that are present in both meshes
// Two attributes in different meshes are considered the same if they have the same
// name and the same type. This may be deceiving because they could in fact have
// different semantic, but this is up to the developer.
// If the left mesh has attributes that are not in the right mesh, their values for the elements
// of the right mesh will be uninitialized
unsigned int id_r;
typename std::set< PointerToAttribute >::iterator al, ar;
// per vertex attributes
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
if(!(*al)._name.empty()){
ar = mr.vert_attr.find(*al);
if(ar!= mr.vert_attr.end()){
id_r = 0;
for(VertexIteratorRight vi=mr.vert.begin();vi!=mr.vert.end();++vi,++id_r)
if( !(*vi).IsD() && (!selected || (*vi).IsS()))
(*al)._handle->CopyValue(remap.vert[Index(mr,*vi)], id_r, (*ar)._handle);
}
}
// per edge attributes
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
if(!(*al)._name.empty()){
ar = mr.edge_attr.find(*al);
if(ar!= mr.edge_attr.end()){
id_r = 0;
for(EdgeIteratorRight ei=mr.edge.begin();ei!=mr.edge.end();++ei,++id_r)
if( !(*ei).IsD() && (!selected || (*ei).IsS()))
(*al)._handle->CopyValue(remap.edge[Index(mr,*ei)], id_r, (*ar)._handle);
}
}
// per face attributes
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
if(!(*al)._name.empty()){
ar = mr.face_attr.find(*al);
if(ar!= mr.face_attr.end()){
id_r = 0;
for(FaceIteratorRight fi=mr.face.begin();fi!=mr.face.end();++fi,++id_r)
if( !(*fi).IsD() && (!selected || (*fi).IsS()))
(*al)._handle->CopyValue(remap.face[Index(mr,*fi)], id_r, (*ar)._handle);
}
}
// per tetra attributes
for(al = ml.tetra_attr.begin(); al != ml.tetra_attr.end(); ++al)
if(!(*al)._name.empty()){
ar = mr.tetra_attr.find(*al);
if(ar!= mr.tetra_attr.end()){
id_r = 0;
for(TetraIteratorRight ti = mr.tetra.begin(); ti != mr.tetra.end(); ++ti, ++id_r)
if( !(*ti).IsD() && (!selected || (*ti).IsS()))
(*al)._handle->CopyValue(remap.tetra[Index(mr, *ti)], id_r, (*ar)._handle);
}
}
// per mesh attributes
// if both ml and mr have an attribute with the same name, no action is done
// if mr has an attribute that is NOT present in ml, the attribute is added to ml
//for(ar = mr.mesh_attr.begin(); ar != mr.mesh_attr.end(); ++ar)
// if(!(*ar)._name.empty()){
// al = ml.mesh_attr.find(*ar);
// if(al== ml.mesh_attr.end())
// //...
// }
MeshAppendConst(ml, mr, selected, adjFlag);
}
/**
@ -494,180 +286,200 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
* or, use the Mesh function that takes a non-const Right Mesh argument.
*/
static void MeshAppendConst(
MeshLeft& ml,
const ConstMeshRight& mr,
const bool selected = false,
const bool adjFlag = false)
MeshLeft& ml,
const ConstMeshRight& mr,
const bool selected = false,
const bool adjFlag = false)
{
// phase 1. allocate on ml vert,edge,face, hedge to accomodat those of mr
// and build the remapping for all
// phase 1. allocate on ml vert,edge,face, hedge to accomodat those of mr
// and build the remapping for all
Remap remap;
Remap remap;
// vertex
remap.vert.resize(mr.vert.size(), Remap::InvalidIndex());
VertexIteratorLeft vp;
size_t svn = UpdateSelection<ConstMeshRight>::VertexCount(mr);
if(selected)
vp=Allocator<MeshLeft>::AddVertices(ml,int(svn));
else
vp=Allocator<MeshLeft>::AddVertices(ml,mr.vn);
// vertex
remap.vert.resize(mr.vert.size(), Remap::InvalidIndex());
VertexIteratorLeft vp;
size_t svn = UpdateSelection<ConstMeshRight>::VertexCount(mr);
if(selected)
vp=Allocator<MeshLeft>::AddVertices(ml,int(svn));
else
vp=Allocator<MeshLeft>::AddVertices(ml,mr.vn);
ForEachVertex(mr, [&](const VertexRight& v)
{
if(!selected || v.IsS())
{
size_t ind=Index(mr,v);
remap.vert[ind]=int(Index(ml,*vp));
++vp;
}
});
// edge
remap.edge.resize(mr.edge.size(), Remap::InvalidIndex());
EdgeIteratorLeft ep;
size_t sen = UpdateSelection<ConstMeshRight>::EdgeCount(mr);
if(selected) ep=Allocator<MeshLeft>::AddEdges(ml,sen);
else ep=Allocator<MeshLeft>::AddEdges(ml,mr.en);
ForEachVertex(mr, [&](const VertexRight& v)
{
if(!selected || v.IsS())
{
size_t ind=Index(mr,v);
remap.vert[ind]=int(Index(ml,*vp));
++vp;
}
});
// edge
remap.edge.resize(mr.edge.size(), Remap::InvalidIndex());
EdgeIteratorLeft ep;
size_t sen = UpdateSelection<ConstMeshRight>::EdgeCount(mr);
if(selected) ep=Allocator<MeshLeft>::AddEdges(ml,sen);
else ep=Allocator<MeshLeft>::AddEdges(ml,mr.en);
ForEachEdge(mr, [&](const EdgeRight& e)
{
if(!selected || e.IsS()){
size_t ind=Index(mr,e);
remap.edge[ind]=int(Index(ml,*ep));
++ep;
}
});
ForEachEdge(mr, [&](const EdgeRight& e)
{
if(!selected || e.IsS()){
size_t ind=Index(mr,e);
remap.edge[ind]=int(Index(ml,*ep));
++ep;
}
});
// face
remap.face.resize(mr.face.size(), Remap::InvalidIndex());
FaceIteratorLeft fp;
size_t sfn = UpdateSelection<ConstMeshRight>::FaceCount(mr);
if(selected) fp=Allocator<MeshLeft>::AddFaces(ml,sfn);
else fp=Allocator<MeshLeft>::AddFaces(ml,mr.fn);
// face
remap.face.resize(mr.face.size(), Remap::InvalidIndex());
FaceIteratorLeft fp;
size_t sfn = UpdateSelection<ConstMeshRight>::FaceCount(mr);
if(selected) fp=Allocator<MeshLeft>::AddFaces(ml,sfn);
else fp=Allocator<MeshLeft>::AddFaces(ml,mr.fn);
ForEachFace(mr, [&](const FaceRight& f)
{
if(!selected || f.IsS()){
size_t ind=Index(mr,f);
remap.face[ind]=int(Index(ml,*fp));
++fp;
}
});
ForEachFace(mr, [&](const FaceRight& f)
{
if(!selected || f.IsS()){
size_t ind=Index(mr,f);
remap.face[ind]=int(Index(ml,*fp));
++fp;
}
});
// hedge
remap.hedge.resize(mr.hedge.size(),Remap::InvalidIndex());
// hedge
remap.hedge.resize(mr.hedge.size(),Remap::InvalidIndex());
ForEachHEdge(mr, [&](const HEdgeRight& he)
{
if(!selected || he.IsS()){
size_t ind=Index(mr,he);
assert(remap.hedge[ind]==Remap::InvalidIndex());
HEdgeIteratorLeft hp = Allocator<MeshLeft>::AddHEdges(ml,1);
(*hp).ImportData(he);
remap.hedge[ind]=Index(ml,*hp);
}
});
ForEachHEdge(mr, [&](const HEdgeRight& he)
{
if(!selected || he.IsS()){
size_t ind=Index(mr,he);
assert(remap.hedge[ind]==Remap::InvalidIndex());
HEdgeIteratorLeft hp = Allocator<MeshLeft>::AddHEdges(ml,1);
(*hp).ImportData(he);
remap.hedge[ind]=Index(ml,*hp);
}
});
remap.tetra.resize(mr.tetra.size(), Remap::InvalidIndex());
remap.tetra.resize(mr.tetra.size(), Remap::InvalidIndex());
ForEachTetra(mr, [&](const TetraRight& t)
{
if (!selected || t.IsS()) {
size_t idx = Index(mr, t);
assert (remap.tetra[idx] == Remap::InvalidIndex());
TetraIteratorLeft tp = Allocator<MeshLeft>::AddTetras(ml, 1);
(*tp).ImportData(t);
remap.tetra[idx] = Index(ml, *tp);
}
});
ForEachTetra(mr, [&](const TetraRight& t)
{
if (!selected || t.IsS()) {
size_t idx = Index(mr, t);
assert (remap.tetra[idx] == Remap::InvalidIndex());
TetraIteratorLeft tp = Allocator<MeshLeft>::AddTetras(ml, 1);
(*tp).ImportData(t);
remap.tetra[idx] = Index(ml, *tp);
}
});
// phase 2.
// copy data from mr to its corresponding elements in ml and adjacencies
// phase 1.5
// manage textures, creating a new one only when necessary
// (not making unuseful duplicates on append) and save a mapping
// vertex
ForEachVertex(mr, [&](const VertexRight& v)
{
if(!selected || v.IsS()){
ml.vert[remap.vert[Index(mr,v)]].ImportData(v);
if(adjFlag) ImportVertexAdj(ml,mr,ml.vert[remap.vert[Index(mr,v)]],v,remap);
}
});
// for each texture in the right mesh, it maps it to the texture index in the
// left mesh
std::vector<unsigned int> mappingTextures(mr.textures.size());
// edge
ForEachEdge(mr, [&](const EdgeRight& e)
{
if(!selected || e.IsS()){
ml.edge[remap.edge[Index(mr,e)]].ImportData(e);
// Edge to Vertex Adj
EdgeLeft &el = ml.edge[remap.edge[Index(mr,e)]];
if(HasEVAdjacency(ml) && HasEVAdjacency(mr)){
el.V(0) = &ml.vert[remap.vert[Index(mr,e.cV(0))]];
el.V(1) = &ml.vert[remap.vert[Index(mr,e.cV(1))]];
}
if(adjFlag) ImportEdgeAdj(ml,mr,el,e,remap);
}
});
unsigned int baseMlT = ml.textures.size();
for (unsigned int i = 0; i < mr.textures.size(); ++i) {
auto it = std::find(ml.textures.begin(), ml.textures.end(), mr.textures[i]);
//if the right texture does not exists in the left mesh
if (it == ml.textures.end()) {
//add the texture in the left mesh and create the mapping
mappingTextures[i] = baseMlT++;
ml.textures.push_back(mr.textures[i]);
}
else {
//the ith right texture will map in the texture found in the left mesh
mappingTextures[i] = it - ml.textures.begin();
}
}
//ml.textures.insert(ml.textures.end(), mr.textures.begin(),mr.textures.end());
// face
const size_t textureOffset = ml.textures.size();
bool WTFlag = HasPerWedgeTexCoord(mr) && (textureOffset>0);
ForEachFace(mr, [&](const FaceRight& f)
{
if(!selected || f.IsS())
{
FaceLeft &fl = ml.face[remap.face[Index(mr,f)]];
fl.Alloc(f.VN());
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
for(int i = 0; i < fl.VN(); ++i)
fl.V(i) = &ml.vert[remap.vert[Index(mr,f.cV(i))]];
}
fl.ImportData(f);
if(WTFlag)
for(int i = 0; i < fl.VN(); ++i)
fl.WT(i).n() += short(textureOffset);
if(adjFlag) ImportFaceAdj(ml,mr,ml.face[remap.face[Index(mr,f)]],f,remap);
// phase 2.
// copy data from mr to its corresponding elements in ml and adjacencies
}
});
// vertex
ForEachVertex(mr, [&](const VertexRight& v)
{
if(!selected || v.IsS()){
ml.vert[remap.vert[Index(mr,v)]].ImportData(v);
if(adjFlag) ImportVertexAdj(ml,mr,ml.vert[remap.vert[Index(mr,v)]],v,remap);
}
});
// hedge
ForEachHEdge(mr, [&](const HEdgeRight& he)
{
if(!selected || he.IsS()){
ml.hedge[remap.hedge[Index(mr,he)]].ImportData(he);
ImportHEdgeAdj(ml,mr,ml.hedge[remap.hedge[Index(mr,he)]],he,remap,selected);
}
});
// edge
ForEachEdge(mr, [&](const EdgeRight& e)
{
if(!selected || e.IsS()){
ml.edge[remap.edge[Index(mr,e)]].ImportData(e);
// Edge to Vertex Adj
EdgeLeft &el = ml.edge[remap.edge[Index(mr,e)]];
if(HasEVAdjacency(ml) && HasEVAdjacency(mr)){
el.V(0) = &ml.vert[remap.vert[Index(mr,e.cV(0))]];
el.V(1) = &ml.vert[remap.vert[Index(mr,e.cV(1))]];
}
if(adjFlag) ImportEdgeAdj(ml,mr,el,e,remap);
}
});
//tetra
ForEachTetra(mr, [&](const TetraRight& t)
{
if(!selected || t.IsS())
{
TetraLeft &tl = ml.tetra[remap.tetra[Index(mr,t)]];
// face
bool WTFlag = HasPerWedgeTexCoord(mr);
ForEachFace(mr, [&](const FaceRight& f)
{
if(!selected || f.IsS())
{
FaceLeft &fl = ml.face[remap.face[Index(mr,f)]];
fl.Alloc(f.VN());
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
for(int i = 0; i < fl.VN(); ++i)
fl.V(i) = &ml.vert[remap.vert[Index(mr,f.cV(i))]];
}
fl.ImportData(f);
if(WTFlag)
for(int i = 0; i < fl.VN(); ++i)
fl.WT(i).n() = mappingTextures[f.WT(i).n()];
if(adjFlag) ImportFaceAdj(ml,mr,ml.face[remap.face[Index(mr,f)]],f,remap);
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
for(int i = 0; i < 4; ++i)
tl.V(i) = &ml.vert[remap.vert[Index(mr,t.cV(i))]];
}
tl.ImportData(t);
if(adjFlag) ImportTetraAdj(ml, mr, ml.tetra[remap.tetra[Index(mr,t)]], t, remap);
}
});
}
});
// hedge
ForEachHEdge(mr, [&](const HEdgeRight& he)
{
if(!selected || he.IsS()){
ml.hedge[remap.hedge[Index(mr,he)]].ImportData(he);
ImportHEdgeAdj(ml,mr,ml.hedge[remap.hedge[Index(mr,he)]],he,remap,selected);
}
});
// phase 3.
// take care of other per mesh data: textures, attributes
//tetra
ForEachTetra(mr, [&](const TetraRight& t)
{
if(!selected || t.IsS())
{
TetraLeft &tl = ml.tetra[remap.tetra[Index(mr,t)]];
// At the end concatenate the vector with texture names.
ml.textures.insert(ml.textures.end(),mr.textures.begin(),mr.textures.end());
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
for(int i = 0; i < 4; ++i)
tl.V(i) = &ml.vert[remap.vert[Index(mr,t.cV(i))]];
}
tl.ImportData(t);
if(adjFlag) ImportTetraAdj(ml, mr, ml.tetra[remap.tetra[Index(mr,t)]], t, remap);
// Attributes. Copy only those attributes that are present in both meshes
// Two attributes in different meshes are considered the same if they have the same
// name and the same type. This may be deceiving because they could in fact have
// different semantic, but this is up to the developer.
// If the left mesh has attributes that are not in the right mesh, their values for the elements
// of the right mesh will be uninitialized
}
});
// phase 3.
// take care of other per mesh data: attributes
// Attributes. Copy only those attributes that are present in both meshes
// Two attributes in different meshes are considered the same if they have the same
// name and the same type. This may be deceiving because they could in fact have
// different semantic, but this is up to the developer.
// If the left mesh has attributes that are not in the right mesh, their values for the elements
// of the right mesh will be uninitialized
unsigned int id_r;
typename std::set< PointerToAttribute >::iterator al, ar;
@ -740,40 +552,42 @@ static void MeshAppendConst(
}
}
// per mesh attributes
// if both ml and mr have an attribute with the same name, no action is done
// if mr has an attribute that is NOT present in ml, the attribute is added to ml
//for(ar = mr.mesh_attr.begin(); ar != mr.mesh_attr.end(); ++ar)
// if(!(*ar)._name.empty()){
// al = ml.mesh_attr.find(*ar);
// if(al== ml.mesh_attr.end())
// //...
// }
// per mesh attributes
// if both ml and mr have an attribute with the same name, no action is done
// if mr has an attribute that is NOT present in ml, the attribute is added to ml
//for(ar = mr.mesh_attr.begin(); ar != mr.mesh_attr.end(); ++ar)
// if(!(*ar)._name.empty()){
// al = ml.mesh_attr.find(*ar);
// if(al== ml.mesh_attr.end())
// //...
// }
}
/*! \brief Copy the second mesh over the first one.
The first mesh is destroyed. If requested only the selected elements are copied.
*/
/**
* \brief Copy the second mesh over the first one.
* The first mesh is destroyed. If requested only the selected elements are copied.
*/
static void MeshCopy(MeshLeft& ml, ConstMeshRight& mr, bool selected=false, const bool adjFlag = false)
{
ml.Clear();
Mesh(ml,mr,selected,adjFlag);
ml.bbox.Import(mr.bbox);
ml.Clear();
Mesh(ml,mr,selected,adjFlag);
ml.bbox.Import(mr.bbox);
}
static void MeshCopyConst(MeshLeft& ml, const ConstMeshRight& mr, bool selected=false, const bool adjFlag = false)
{
ml.Clear();
MeshAppendConst(ml,mr,selected,adjFlag);
ml.bbox.Import(mr.bbox);
ml.Clear();
MeshAppendConst(ml,mr,selected,adjFlag);
ml.bbox.Import(mr.bbox);
}
/*! \brief %Append only the selected elements of second mesh to the first one.
It is just a wrap of the main Append::Mesh()
*/
/**
* \brief %Append only the selected elements of second mesh to the first one.
*
* It is just a wrap of the main Append::Mesh()
*/
static void Selected(MeshLeft& ml, ConstMeshRight& mr)
{
Mesh(ml,mr,true);
Mesh(ml,mr,true);
}
}; // end of class Append