_node_reduction=const_cast<DataArrayInt*>(nr);
}
+void MEDMeshMultiLev::setCellReduction(const DataArrayInt *cr)
+{
+ if(_pfls.size()!=1)
+ throw INTERP_KERNEL::Exception("MEDMeshMultiLev::setCellReduction : can be used only for single geo type mesh !");
+ _pfls[0]=const_cast<DataArrayInt*>(cr);
+ if(cr)
+ cr->incrRef();
+}
+
bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const
{
if(fst.getType()==ON_NODES)
}
/*!
+ * To be called only once ! Because due to some optimizations (sometimes aggressive) the internal state can be changed...
* If returned value is false output pointer \a coords is not the internal pointer. If returned value is true output pointer \a coords is directly the internal pointer.
* If true is returned, the \a coords output parameter should be used with care (non const method call) to avoid to change the internal state of MEDFileUMesh instance.
*/
{
*dPtr++=connIPtr[1]-connIPtr[0];
dPtr=std::copy(connPtr+connIPtr[0],connPtr+connIPtr[1],dPtr);
- *cPtr++=k; k+=connIPtr[1]-connIPtr[0];
+ *cPtr++=k; k+=connIPtr[1]-connIPtr[0]+1;
}
}
else
{ faceLocations=0; faces=0; }
else
{ faceLocations=e.retn(); faces=f.retn(); }
- return tmp==((DataArrayDouble *)a);
+ return _mesh->isObjectInTheProgeny(coords);
}
void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
//=
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m):MEDMeshMultiLev(m),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev):MEDMeshMultiLev(m),_is_internal(true)
{
+ initStdFieldOfIntegers(m);
}
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev):MEDMeshMultiLev(m),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
+{
+ initStdFieldOfIntegers(m);
+}
+
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true),_face_fam_ids(other._face_fam_ids),_face_fam_ids_nocpy(other._face_fam_ids_nocpy),_face_num_ids(other._face_num_ids),_face_num_ids_nocpy(other._face_num_ids_nocpy)
+{
+}
+
+void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m)
{
// ids fields management
_cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
tmp->incrRef();
_node_num_ids=const_cast<DataArrayInt *>(tmp);
}
-}
-
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
-{
- // ids fields management
- _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
- const DataArrayInt *tmp(0);
- tmp=m->getFamilyFieldAtLevel(0);
- if(tmp)
- {
- tmp->incrRef();
- _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
- }
- tmp=m->getNumberFieldAtLevel(0);
- if(tmp)
- {
- tmp->incrRef();
- _cell_num_ids=const_cast<DataArrayInt *>(tmp);
- }
- //
- _node_fam_ids_nocpy=true; _node_num_ids_nocpy=true;
- tmp=0;
- tmp=m->getFamilyFieldAtLevel(1);
+ // faces (if any)
+ _face_fam_ids_nocpy=true; _face_num_ids_nocpy=true;
+ tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _node_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _face_fam_ids=const_cast<DataArrayInt *>(tmp);
}
- tmp=m->getNumberFieldAtLevel(1);
+ tmp=m->getNumberFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _node_num_ids=const_cast<DataArrayInt *>(tmp);
+ _face_num_ids=const_cast<DataArrayInt *>(tmp);
}
}
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true)
+void MEDStructuredMeshMultiLev::moveFaceToCell() const
{
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_fam_ids_nocpy=_face_fam_ids_nocpy;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_num_ids_nocpy=_face_num_ids_nocpy;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_fam_ids=_face_fam_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_fam_ids=0;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_num_ids=_face_num_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_num_ids=0;
}
bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const
if(!_pfls.empty())
pfl=_pfls[0];
MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
+ moveFaceToCell();
MEDCouplingAutoRefCountObjectPtr<MEDUMeshMultiLev> ret2(new MEDUMeshMultiLev(*this,facesIfPresent2));
if(pfl)
- throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase : case is not treated yet for profile on implicit unstructured mesh.");
+ ret2->setCellReduction(pfl);
if(nr)
throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase : case is not treated yet for node reduction on implicit unstructured mesh.");
ret=ret2.retn();