throw INTERP_KERNEL::Exception("Functionnality of renumbering cells unavailable for ExtrudedMesh");
}
+/*!
+ * \b WARNING in case of modif think to update MEDFileUMesh::New implementation !
+ * \sa MEDFileUMesh::New
+ */
MEDCouplingUMesh *MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh() const
{
MCAuto<MEDCouplingUMesh> mesh2DZC(_mesh2D->deepCopyConnectivityOnly());
return ret.retn();
}
+/*!
+ * \b WARNING in case of modif think to update MEDFileUMesh::New implementation !
+ * \sa MEDFileUMesh::New
+ */
MEDCouplingUMesh *MEDCouplingMappedExtrudedMesh::buildUnstructured() const
{
return build3DUnstructuredMesh();
const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
+ MEDCOUPLING_EXPORT int get2DCellIdForExtrusion() const { return _cell_2D_id; }
private:
MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D);
static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D) throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
+ int get2DCellIdForExtrusion() const;
%extend {
MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
{
#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "InterpKernelAutoPtr.hxx"
const char MEDFileMesh::DFT_FAM_NAME[]="FAMILLE_ZERO";
+const char MEDFileUMesh::SPE_FAM_STR_EXTRUDED_MESH[]="HIDDEN_FAM_EXT_MESH@";
+
MEDFileMesh::MEDFileMesh():_order(-1),_iteration(-1),_time(0.),_univ_wr_status(true),_axis_type(AX_CART)
{
}
return new MEDFileUMesh(fid,ms.front(),dt,it,mrs);
}
+/*!
+ * \b WARNING this implementation is dependant from MEDCouplingMappedExtrudedMesh::buildUnstructured !
+ * \sa MEDCouplingMappedExtrudedMesh::buildUnstructured , MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh
+ */
+MEDFileUMesh *MEDFileUMesh::New(const MEDCouplingMappedExtrudedMesh *mem)
+{
+ if(!mem)
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::New : null input vector !");
+ MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
+ MCAuto<MEDCouplingUMesh> m3D(mem->buildUnstructured());
+ MCAuto<MEDCouplingUMesh> m2D(mem->getMesh2D()->deepCopy());
+ m2D->zipCoords();
+ m2D->setCoords(m3D->getCoords());
+ ret->setMeshAtLevel(0,m3D);
+ ret->setMeshAtLevel(-1,m2D);
+ ret->setFamilyId(GetSpeStr4ExtMesh(),mem->get2DCellIdForExtrusion());
+ return ret.retn();
+}
+
/*!
* Returns an empty instance of MEDFileUMesh.
* \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this
return ret;
}
+MEDCouplingMappedExtrudedMesh *MEDFileUMesh::convertToExtrudedMesh() const
+{
+ if(getMeshDimension()!=3)
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : works only for 3D mesh !");
+ MCAuto<MEDCouplingUMesh> m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1));
+ if(m3D.isNull() || m2D.isNull())
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !");
+ int zeId(getFamilyId(GetSpeStr4ExtMesh()));
+ MCAuto<MEDCouplingMappedExtrudedMesh> ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId));
+ return ret.retn();
+}
+
void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
clearNonDiscrAttributes();
MEDLOADER_EXPORT static const char DFT_FAM_NAME[];
};
+ class MEDCouplingMappedExtrudedMesh;
+
class MEDFileUMesh : public MEDFileMesh
{
friend class MEDFileMesh;
public:
MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
MEDLOADER_EXPORT static MEDFileUMesh *New();
MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; }
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
MEDLOADER_EXPORT MCAuto<MEDFileUMesh> symmetry3DPlane(const double point[3], const double normalVector[3]) const;
MEDLOADER_EXPORT static MCAuto<MEDFileUMesh> Aggregate(const std::vector<const MEDFileUMesh *>& meshes);
+ MEDLOADER_EXPORT MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
// serialization
MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
void changeFamilyIdArr(int oldId, int newId);
std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
MCAuto<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
+ private:
+ static const char SPE_FAM_STR_EXTRUDED_MESH[];
private:
std::vector< MCAuto<MEDFileUMeshSplitL1> > _ms;
MCAuto<DataArrayDouble> _coords;
%newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
%newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
%newobject MEDCoupling::MEDFileUMesh::Aggregate;
+%newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
%newobject MEDCoupling::MEDFileCMesh::New;
%newobject MEDCoupling::MEDFileCurveLinearMesh::New;
%newobject MEDCoupling::MEDFileMeshMultiTS::New;
public:
static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+ static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem) throw(INTERP_KERNEL::Exception);
static MEDFileUMesh *New();
+ static const char *GetSpeStr4ExtMesh();
~MEDFileUMesh();
int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const throw(INTERP_KERNEL::Exception);
MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const throw(INTERP_KERNEL::Exception);
MEDFileUMesh *quadraticToLinear(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const throw(INTERP_KERNEL::Exception);
%extend
{
MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
return MEDFileUMesh::New(fileName,mrs);
}
+ MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileUMesh::New(mem);
+ }
+
MEDFileUMesh()
{
return MEDFileUMesh::New();
mfd=MEDFileData.Aggregate([MEDFileData(fname1),MEDFileData(fname2)])
CheckMFD(self,mfd)
pass
+
+ def testExtrudedMesh1(self):
+ fname1="Pyfile107.med"
+ arrX=DataArrayDouble([0,1,2,3]) ; arrY=DataArrayDouble([0,1,2,3,4]) ; arrZ=DataArrayDouble([0,1,2,3,4,5])
+ mesh3D=MEDCouplingCMesh() ; mesh3D.setCoords(arrX,arrY,arrZ)
+ ex=MEDCouplingMappedExtrudedMesh(mesh3D)
+ mm=MEDFileUMesh(ex)
+ ex2=mm.convertToExtrudedMesh()
+ self.assertTrue(ex.isEqual(ex2,1e-12))
+ pass
pass