{
};
+ interface MEDCouplingIMeshCorbaInterface : MEDCouplingStructuredMeshCorbaInterface
+ {
+ };
+
interface MEDCouplingFieldCorbaInterface : MEDCouplingRefCountCorbaInterface
{
MEDCouplingMeshCorbaInterface getMesh();
SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface getCLMesh();
SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface get1SGTUMesh();
SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface get1DGTUMesh();
+ SALOME_MED::MEDCouplingIMeshCorbaInterface getIMesh();
SALOME_MED::MEDCouplingFieldDoubleCorbaInterface getFieldScalarOn2DNT();
SALOME_MED::MEDCouplingFieldDoubleCorbaInterface getFieldNodeScalarOn2DNT();
SALOME_MED::MEDCouplingFieldDoubleCorbaInterface getFieldScalarOn3DNT();
MEDCouplingMemArrayChar.cxx
MEDCouplingTimeLabel.cxx
MEDCouplingCMesh.cxx
+ MEDCouplingIMesh.cxx
MEDCouplingCurveLinearMesh.cxx
MEDCouplingStructuredMesh.cxx
MEDCouplingTimeDiscretization.cxx
* @throw if other and this have not same mesh type.
*/
void MEDCouplingCMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
-{
- const MEDCouplingCMesh *otherC=dynamic_cast<const MEDCouplingCMesh *>(other);
+{
+ MEDCouplingStructuredMesh::copyTinyStringsFrom(other);
+ const MEDCouplingCMesh *otherC(dynamic_cast<const MEDCouplingCMesh *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::copyTinyStringsFrom : meshes have not same type !");
- MEDCouplingStructuredMesh::copyTinyStringsFrom(other);
if(_x_array && otherC->_x_array)
_x_array->copyStringInfoFrom(*otherC->_x_array);
if(_y_array && otherC->_y_array)
reason="mesh given in input is not castable in MEDCouplingCMesh !";
return false;
}
- if(!MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason))
+ if(!MEDCouplingStructuredMesh::isEqualIfNotWhy(other,prec,reason))
return false;
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
const DataArrayDouble *otherArr[3]={otherC->_x_array,otherC->_y_array,otherC->_z_array};
/*!
* Nothing is done here (except to check that the other is a ParaMEDMEM::MEDCouplingCMesh instance too).
- * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingCMesh, 'this' and 'other' are the same !
+ * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingCMesh, \a this and \a other are the same !
*/
void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor) const
{
- const MEDCouplingCMesh *otherC=dynamic_cast<const MEDCouplingCMesh *>(other);
- if(!otherC)
- throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : other is NOT a cartesian mesh ! Impossible to check equivalence !");
+ if(!isEqualWithoutConsideringStr(other,prec))
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
}
void MEDCouplingCMesh::checkCoherency() const
MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
{
checkCoherency();
- int dim(getMeshDimension());
+ int dim(getSpaceDimension());
if(dim!=(int)cellPart.size())
{
- std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the mesh dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
+ std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> ret(dynamic_cast<MEDCouplingCMesh *>(deepCpy()));
double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
- ret << "Mesh and SpaceDimension dimension : " << getSpaceDimension() << "\n\nArrays :\n________\n\n";
+ ret << "Space dimension : " << getSpaceDimension() << "\n\nArrays :\n________\n\n";
if(_x_array)
{
ret << "X Array :\n";
void MEDCouplingCMesh::rotate(const double *center, const double *vector, double angle)
{
- throw INTERP_KERNEL::Exception("No rotation available on CMesh : Traduce it to StructuredMesh to apply it !");
+ throw INTERP_KERNEL::Exception("No rotation available on CMesh : Traduce it to untructured mesh to apply it !");
}
/*!
namespace ParaMEDMEM
{
- class DataArrayDouble;
- class MEDCouplingUMesh;
-
class MEDCouplingCMesh : public MEDCouplingStructuredMesh
{
public:
/*!
* Nothing is done here (except to check that the other is a ParaMEDMEM::MEDCouplingCurveLinearMesh instance too).
- * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingCurveLinearMesh, 'this' and 'other' are the same !
+ * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingCurveLinearMesh, \a this and \a other are the same !
*/
void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor) const
{
- const MEDCouplingCurveLinearMesh *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
- if(!otherC)
- throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : other is NOT a cartesian mesh ! Impossible to check equivalence !");
+ if(!isEqualWithoutConsideringStr(other,prec))
+ throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
}
void MEDCouplingCurveLinearMesh::checkCoherency() const
MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
{
checkCoherency();
- int dim(getMeshDimension());
+ int dim(getSpaceDimension());
std::vector<int> dims(getMeshDimension());
if(dim!=(int)cellPart.size())
{
- std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::buildStructuredSubPart : the mesh dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
+ std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
std::vector< std::pair<int,int> > nodePartFormat(cellPart);
namespace ParaMEDMEM
{
- class DataArrayDouble;
- class MEDCouplingUMesh;
-
class MEDCouplingCurveLinearMesh : public MEDCouplingStructuredMesh
{
public:
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+
+#include "MEDCouplingIMesh.hxx"
+#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+
+#include <functional>
+#include <algorithm>
+#include <sstream>
+#include <numeric>
+
+using namespace ParaMEDMEM;
+
+MEDCouplingIMesh::MEDCouplingIMesh():_space_dim(-1)
+{
+ _origin[0]=0.; _origin[1]=0.; _origin[2]=0.;
+ _dxyz[0]=0.; _dxyz[1]=0.; _dxyz[2]=0.;
+ _structure[0]=0; _structure[1]=0; _structure[2]=0;
+}
+
+MEDCouplingIMesh::MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCopy):MEDCouplingStructuredMesh(other,deepCopy),_space_dim(other._space_dim),_axis_unit(other._axis_unit)
+{
+ _origin[0]=other._origin[0]; _origin[1]=other._origin[1]; _origin[2]=other._origin[2];
+ _dxyz[0]=other._dxyz[0]; _dxyz[1]=other._dxyz[1]; _dxyz[2]=other._dxyz[2];
+ _structure[0]=other._structure[0]; _structure[1]=other._structure[1]; _structure[2]=other._structure[2];
+}
+
+MEDCouplingIMesh::~MEDCouplingIMesh()
+{
+}
+
+MEDCouplingIMesh *MEDCouplingIMesh::New()
+{
+ return new MEDCouplingIMesh;
+}
+
+MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+ const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(new MEDCouplingIMesh);
+ ret->setName(meshName);
+ ret->setSpaceDimension(spaceDim);
+ ret->setNodeStruct(nodeStrctStart,nodeStrctStop);
+ ret->setOrigin(originStart,originStop);
+ ret->setDXYZ(dxyzStart,dxyzStop);
+ return ret.retn();
+}
+
+MEDCouplingMesh *MEDCouplingIMesh::deepCpy() const
+{
+ return clone(true);
+}
+
+MEDCouplingIMesh *MEDCouplingIMesh::clone(bool recDeepCpy) const
+{
+ return new MEDCouplingIMesh(*this,recDeepCpy);
+}
+
+void MEDCouplingIMesh::setNodeStruct(const int *nodeStrctStart, const int *nodeStrctStop)
+{
+ checkSpaceDimension();
+ int sz((int)std::distance(nodeStrctStart,nodeStrctStop));
+ if(sz!=_space_dim)
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setNodeStruct : input vector of node structure has not the right size ! Or change space dimension before calling it !");
+ std::copy(nodeStrctStart,nodeStrctStop,_structure);
+ declareAsNew();
+}
+
+std::vector<int> MEDCouplingIMesh::getNodeStruct() const
+{
+ checkSpaceDimension();
+ return std::vector<int>(_structure,_structure+_space_dim);
+}
+
+void MEDCouplingIMesh::setOrigin(const double *originStart, const double *originStop)
+{
+ checkSpaceDimension();
+ int sz((int)std::distance(originStart,originStop));
+ if(sz!=_space_dim)
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setOrigin : input vector of origin vector has not the right size ! Or change space dimension before calling it !");
+ std::copy(originStart,originStop,_origin);
+ declareAsNew();
+}
+
+std::vector<double> MEDCouplingIMesh::getOrigin() const
+{
+ checkSpaceDimension();
+ return std::vector<double>(_origin,_origin+_space_dim);
+}
+
+void MEDCouplingIMesh::setDXYZ(const double *dxyzStart, const double *dxyzStop)
+{
+ checkSpaceDimension();
+ int sz((int)std::distance(dxyzStart,dxyzStop));
+ if(sz!=_space_dim)
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setDXYZ : input vector of dxyz vector has not the right size ! Or change space dimension before calling it !");
+ std::copy(dxyzStart,dxyzStop,_dxyz);
+ declareAsNew();
+}
+
+std::vector<double> MEDCouplingIMesh::getDXYZ() const
+{
+ checkSpaceDimension();
+ return std::vector<double>(_dxyz,_dxyz+_space_dim);
+}
+
+void MEDCouplingIMesh::setAxisUnit(const std::string& unitName)
+{
+ _axis_unit=unitName;
+ declareAsNew();
+}
+
+std::string MEDCouplingIMesh::getAxisUnit() const
+{
+ return _axis_unit;
+}
+
+/*!
+ * This method returns the measure of any cell in \a this.
+ * This specific method of image grid mesh utilizes the fact that any cell in \a this have the same measure.
+ * The value returned by this method is those used to feed the returned field in the MEDCouplingIMesh::getMeasureField.
+ *
+ * \sa getMeasureField
+ */
+double MEDCouplingIMesh::getMeasureOfAnyCell() const
+{
+ checkCoherency();
+ int dim(getSpaceDimension());
+ double ret(1.);
+ for(int i=0;i<dim;i++)
+ ret*=fabs(_dxyz[i]);
+ return ret;
+}
+
+/*!
+ * This method is allows to convert \a this into MEDCouplingCMesh instance.
+ * This method is the middle level between MEDCouplingIMesh and the most general MEDCouplingUMesh.
+ * This method is useful for MED writers that do not have still the image grid support.
+ *
+ * \sa MEDCouplingMesh::buildUnstructured
+ */
+MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const
+{
+ checkCoherency();
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> ret(MEDCouplingCMesh::New());
+ try
+ { ret->copyTinyInfoFrom(this); }
+ catch(INTERP_KERNEL::Exception& e) { }
+ int spaceDim(getSpaceDimension());
+ std::vector<std::string> infos(buildInfoOnComponents());
+ for(int i=0;i<spaceDim;i++)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]);
+ arr->iota(); arr->applyLin(_dxyz[i],_origin[i]);
+ ret->setCoordsAt(i,arr);
+ }
+ return ret.retn();
+}
+
+void MEDCouplingIMesh::setSpaceDimension(int spaceDim)
+{
+ if(spaceDim==_space_dim)
+ return ;
+ CheckSpaceDimension(spaceDim);
+ _space_dim=spaceDim;
+ declareAsNew();
+}
+
+void MEDCouplingIMesh::updateTime() const
+{
+}
+
+std::size_t MEDCouplingIMesh::getHeapMemorySizeWithoutChildren() const
+{
+ return MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren();
+}
+
+std::vector<const BigMemoryObject *> MEDCouplingIMesh::getDirectChildren() const
+{
+ return std::vector<const BigMemoryObject *>();
+}
+
+/*!
+ * This method copyies all tiny strings from other (name and components name).
+ * @throw if other and this have not same mesh type.
+ */
+void MEDCouplingIMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
+{
+ const MEDCouplingIMesh *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
+ if(!otherC)
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::copyTinyStringsFrom : meshes have not same type !");
+ MEDCouplingStructuredMesh::copyTinyStringsFrom(other);
+ declareAsNew();
+}
+
+bool MEDCouplingIMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const
+{
+ if(!other)
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::isEqualIfNotWhy : input other pointer is null !");
+ const MEDCouplingIMesh *otherC(dynamic_cast<const MEDCouplingIMesh *>(other));
+ if(!otherC)
+ {
+ reason="mesh given in input is not castable in MEDCouplingIMesh !";
+ return false;
+ }
+ if(!MEDCouplingStructuredMesh::isEqualIfNotWhy(other,prec,reason))
+ return false;
+ if(!isEqualWithoutConsideringStrInternal(otherC,prec,reason))
+ return false;
+ if(_axis_unit!=otherC->_axis_unit)
+ {
+ reason="The units of axis are not the same !";
+ return false;
+ }
+ return true;
+}
+
+bool MEDCouplingIMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
+{
+ const MEDCouplingIMesh *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
+ if(!otherC)
+ return false;
+ std::string tmp;
+ return isEqualWithoutConsideringStrInternal(other,prec,tmp);
+}
+
+bool MEDCouplingIMesh::isEqualWithoutConsideringStrInternal(const MEDCouplingMesh *other, double prec, std::string& reason) const
+{
+ const MEDCouplingIMesh *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
+ if(!otherC)
+ return false;
+ if(_space_dim!=otherC->_space_dim)
+ {
+ std::ostringstream oss;
+ oss << "The spaceDimension of this (" << _space_dim << ") is not equal to those of other (" << otherC->_space_dim << ") !";
+ return false;
+ }
+ checkSpaceDimension();
+ for(int i=0;i<_space_dim;i++)
+ {
+ if(fabs(_origin[i]-otherC->_origin[i])>prec)
+ {
+ std::ostringstream oss;
+ oss << "The origin of this and other differs at " << i << " !";
+ reason=oss.str();
+ return false;
+ }
+ }
+ for(int i=0;i<_space_dim;i++)
+ {
+ if(fabs(_dxyz[i]-otherC->_dxyz[i])>prec)
+ {
+ std::ostringstream oss;
+ oss << "The delta of this and other differs at " << i << " !";
+ reason=oss.str();
+ return false;
+ }
+ }
+ for(int i=0;i<_space_dim;i++)
+ {
+ if(_structure[i]!=otherC->_structure[i])
+ {
+ std::ostringstream oss;
+ oss << "The structure of this and other differs at " << i << " !";
+ reason=oss.str();
+ return false;
+ }
+ }
+ return true;
+}
+
+void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+{
+ if(!isEqualWithoutConsideringStr(other,prec))
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalWith : Meshes are not the same !");
+}
+
+/*!
+ * Nothing is done here (except to check that the other is a ParaMEDMEM::MEDCouplingIMesh instance too).
+ * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingIMesh, \a this and \a other are the same !
+ */
+void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayInt *&cellCor) const
+{
+ if(!isEqualWithoutConsideringStr(other,prec))
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
+}
+
+void MEDCouplingIMesh::checkCoherency() const
+{
+ checkSpaceDimension();
+ for(int i=0;i<_space_dim;i++)
+ if(_structure[i]<1)
+ {
+ std::ostringstream oss; oss << "MEDCouplingIMesh::checkCoherency : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void MEDCouplingIMesh::checkCoherency1(double eps) const
+{
+ checkCoherency();
+}
+
+void MEDCouplingIMesh::checkCoherency2(double eps) const
+{
+ checkCoherency1(eps);
+}
+
+void MEDCouplingIMesh::getSplitCellValues(int *res) const
+{
+ int meshDim(getMeshDimension());
+ for(int l=0;l<meshDim;l++)
+ {
+ int val=1;
+ for(int p=0;p<meshDim-l-1;p++)
+ val*=_structure[p]-1;
+ res[meshDim-l-1]=val;
+ }
+}
+
+void MEDCouplingIMesh::getSplitNodeValues(int *res) const
+{
+ int spaceDim(getSpaceDimension());
+ for(int l=0;l<spaceDim;l++)
+ {
+ int val=1;
+ for(int p=0;p<spaceDim-l-1;p++)
+ val*=_structure[p];
+ res[spaceDim-l-1]=val;
+ }
+}
+
+void MEDCouplingIMesh::getNodeGridStructure(int *res) const
+{
+ checkSpaceDimension();
+ std::copy(_structure,_structure+_space_dim,res);
+}
+
+std::vector<int> MEDCouplingIMesh::getNodeGridStructure() const
+{
+ checkSpaceDimension();
+ std::vector<int> ret(_structure,_structure+_space_dim);
+ return ret;
+}
+
+MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
+{
+ checkCoherency();
+ int dim(getSpaceDimension());
+ if(dim!=(int)cellPart.size())
+ {
+ std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ double retOrigin[3]={0.,0.,0.};
+ int retStruct[3]={0,0,0};
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(dynamic_cast<MEDCouplingIMesh *>(deepCpy()));
+ for(int i=0;i<dim;i++)
+ {
+ int startNode(cellPart[i].first),endNode(cellPart[i].second+1);
+ int myDelta(endNode-startNode);
+ if(startNode<0 || startNode>=_structure[i])
+ {
+ std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : At dimension #" << i << " the start node id is " << startNode << " it should be in [0," << _structure[i] << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(myDelta<0 || myDelta>_structure[i])
+ {
+ std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : Along dimension #" << i << " the number of nodes is " << _structure[i] << ", and you are requesting for " << myDelta << " nodes wide range !" << std::endl;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ retOrigin[i]=_origin[i]+startNode*_dxyz[i];
+ retStruct[i]=myDelta;
+ }
+ ret->setNodeStruct(retStruct,retStruct+dim);
+ ret->setOrigin(retOrigin,retOrigin+dim);
+ ret->checkCoherency();
+ return ret.retn();
+}
+
+/*!
+ * Return the space dimension of \a this.
+ */
+int MEDCouplingIMesh::getSpaceDimension() const
+{
+ return _space_dim;
+}
+
+void MEDCouplingIMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+{
+ int tmp[3];
+ int spaceDim(getSpaceDimension());
+ getSplitNodeValues(tmp);
+ int tmp2[3];
+ GetPosFromId(nodeId,spaceDim,tmp,tmp2);
+ for(int j=0;j<spaceDim;j++)
+ coo.push_back(_origin[j]+_dxyz[j]*tmp2[j]);
+}
+
+std::string MEDCouplingIMesh::simpleRepr() const
+{
+ std::ostringstream ret;
+ ret << "Image grid with name : \"" << getName() << "\"\n";
+ ret << "Description of mesh : \"" << getDescription() << "\"\n";
+ int tmpp1,tmpp2;
+ double tt(getTime(tmpp1,tmpp2));
+ int spaceDim(_space_dim);
+ ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
+ ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
+ ret << "Space dimension : " << spaceDim << "\n";
+ if(spaceDim<0 || spaceDim>3)
+ return ret.str();
+ ret << "The nodal structure is : "; std::copy(_structure,_structure+spaceDim,std::ostream_iterator<int>(ret," ")); ret << "\n";
+ ret << "The origin position is [" << _axis_unit << "]: ";
+ std::copy(_origin,_origin+spaceDim,std::ostream_iterator<double>(ret," ")); ret << "\n";
+ ret << "The intervals along axis are : ";
+ std::copy(_dxyz,_dxyz+spaceDim,std::ostream_iterator<double>(ret," ")); ret << "\n";
+ return ret.str();
+}
+
+std::string MEDCouplingIMesh::advancedRepr() const
+{
+ return simpleRepr();
+}
+
+void MEDCouplingIMesh::getBoundingBox(double *bbox) const
+{
+ checkCoherency();
+ int dim(getSpaceDimension());
+ for(int idim=0; idim<dim; idim++)
+ {
+ bbox[2*idim]=_origin[idim];
+ bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*_structure[idim];
+ }
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble containing volumes of cells constituting \a this
+ * mesh.<br>
+ * For 1D cells, the returned field contains lengths.<br>
+ * For 2D cells, the returned field contains areas.<br>
+ * For 3D cells, the returned field contains volumes.
+ * \param [in] isAbs - a not used parameter.
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble on cells
+ * and one time . The caller is to delete this field using decrRef() as it is no
+ * more needed.
+ */
+MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool isAbs) const
+{
+ checkCoherency();
+ std::string name="MeasureOfMesh_";
+ name+=getName();
+ int nbelem(getNumberOfCells());
+ MEDCouplingFieldDouble *field(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
+ field->setName(name);
+ DataArrayDouble* array(DataArrayDouble::New());
+ array->alloc(nbelem,1);
+ array->fillWithValue(getMeasureOfAnyCell());
+ field->setArray(array) ;
+ array->decrRef();
+ field->setMesh(const_cast<MEDCouplingIMesh *>(this));
+ field->synchronizeTimeWithMesh();
+ return field;
+}
+
+/*!
+ * not implemented yet !
+ */
+MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool isAbs) const
+{
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::getMeasureFieldOnNode : not implemented yet !");
+ //return 0;
+}
+
+int MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const
+{
+ int dim(getSpaceDimension()),ret(0),coeff(1);
+ for(int i=0;i<dim;i++)
+ {
+ int nbOfCells(_structure[i]-1);
+ double ref(pos[i]);
+ int tmp((ref-_origin[i])/_dxyz[i]);
+ if(tmp>=0 && tmp<nbOfCells)
+ {
+ ret+=coeff*tmp;
+ coeff*=nbOfCells;
+ }
+ else
+ return -1;
+ }
+ return ret;
+}
+
+void MEDCouplingIMesh::rotate(const double *center, const double *vector, double angle)
+{
+ throw INTERP_KERNEL::Exception("No rotation available on IMesh : Traduce it to unstructured mesh to apply it !");
+}
+
+/*!
+ * Translates all nodes of \a this mesh by a given vector. Actually, it adds each
+ * component of the \a vector to all node coordinates of a corresponding axis.
+ * \param [in] vector - the translation vector whose size must be not less than \a
+ * this->getSpaceDimension().
+ */
+void MEDCouplingIMesh::translate(const double *vector)
+{
+ checkSpaceDimension();
+ int dim(getSpaceDimension());
+ std::transform(_origin,_origin+dim,vector,_origin,std::plus<double>());
+ declareAsNew();
+}
+
+/*!
+ * Applies scaling transformation to all nodes of \a this mesh.
+ * \param [in] point - coordinates of a scaling center. This array is to be of
+ * size \a this->getSpaceDimension() at least.
+ * \param [in] factor - a scale factor.
+ */
+void MEDCouplingIMesh::scale(const double *point, double factor)
+{
+ checkSpaceDimension();
+ int dim(getSpaceDimension());
+ std::transform(_origin,_origin+dim,point,_origin,std::minus<double>());
+ std::transform(_origin,_origin+dim,_origin,std::bind2nd(std::multiplies<double>(),factor));
+ std::transform(_dxyz,_dxyz+dim,_dxyz,std::bind2nd(std::multiplies<double>(),factor));
+ std::transform(_origin,_origin+dim,point,_origin,std::plus<double>());
+ declareAsNew();
+}
+
+MEDCouplingMesh *MEDCouplingIMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
+{
+ //not implemented yet !
+ return 0;
+}
+
+/*!
+ * Returns a new DataArrayDouble holding coordinates of all nodes of \a this mesh.
+ * \return DataArrayDouble * - a new instance of DataArrayDouble, of size \a
+ * this->getNumberOfNodes() tuples per \a this->getSpaceDimension()
+ * components. The caller is to delete this array using decrRef() as it is
+ * no more needed.
+ */
+DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const
+{
+ checkCoherency();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes());
+ ret->alloc(nbNodes,spaceDim);
+ double *pt(ret->getPointer());
+ ret->setInfoOnComponents(buildInfoOnComponents());
+ int tmp2[3],tmp[3];
+ getSplitNodeValues(tmp);
+ for(int i=0;i<nbNodes;i++)
+ {
+ GetPosFromId(i,spaceDim,tmp,tmp2);
+ for(int j=0;j<spaceDim;j++)
+ pt[i*spaceDim+j]=_dxyz[j]*tmp2[j]+_origin[j];
+ }
+ return ret.retn();
+}
+
+/*!
+ * Returns a new DataArrayDouble holding barycenters of all cells. The barycenter is
+ * computed by averaging coordinates of cell nodes.
+ * \return DataArrayDouble * - a new instance of DataArrayDouble, of size \a
+ * this->getNumberOfCells() tuples per \a this->getSpaceDimension()
+ * components. The caller is to delete this array using decrRef() as it is
+ * no more needed.
+ */
+DataArrayDouble *MEDCouplingIMesh::getBarycenterAndOwner() const
+{
+ checkCoherency();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3];
+ ret->alloc(nbCells,spaceDim);
+ double *pt(ret->getPointer()),shiftOrigin[3];
+ std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind2nd(std::multiplies<double>(),0.5));
+ std::transform(_origin,_origin+spaceDim,shiftOrigin,shiftOrigin,std::plus<double>());
+ getSplitCellValues(tmp);
+ ret->setInfoOnComponents(buildInfoOnComponents());
+ for(int i=0;i<nbCells;i++)
+ {
+ GetPosFromId(i,spaceDim,tmp,tmp2);
+ for(int j=0;j<spaceDim;j++)
+ pt[i*spaceDim+j]=_dxyz[j]*tmp2[j]+shiftOrigin[j];
+ }
+ return ret.retn();
+}
+
+DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const
+{
+ return MEDCouplingIMesh::getBarycenterAndOwner();
+}
+
+void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check)
+{
+ throw INTERP_KERNEL::Exception("Functionnality of renumbering cell not available for IMesh !");
+}
+
+void MEDCouplingIMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+{
+ int it,order;
+ double time(getTime(it,order));
+ tinyInfo.clear();
+ tinyInfoD.clear();
+ littleStrings.clear();
+ littleStrings.push_back(getName());
+ littleStrings.push_back(getDescription());
+ littleStrings.push_back(getTimeUnit());
+ littleStrings.push_back(getAxisUnit());
+ tinyInfo.push_back(it);
+ tinyInfo.push_back(order);
+ tinyInfo.push_back(_space_dim);
+ tinyInfo.insert(tinyInfo.end(),_structure,_structure+3);
+ tinyInfoD.push_back(time);
+ tinyInfoD.insert(tinyInfoD.end(),_dxyz,_dxyz+3);
+ tinyInfoD.insert(tinyInfoD.end(),_origin,_origin+3);
+}
+
+void MEDCouplingIMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+{
+ a1->alloc(0,1);
+ a2->alloc(0,1);
+}
+
+void MEDCouplingIMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+{
+ a1=DataArrayInt::New();
+ a1->alloc(0,1);
+ a2=DataArrayDouble::New();
+ a2->alloc(0,1);
+}
+
+void MEDCouplingIMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ const std::vector<std::string>& littleStrings)
+{
+ setName(littleStrings[0]);
+ setDescription(littleStrings[1]);
+ setTimeUnit(littleStrings[2]);
+ setAxisUnit(littleStrings[3]);
+ setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]);
+ _space_dim=tinyInfo[2];
+ _structure[0]=tinyInfo[3]; _structure[1]=tinyInfo[4]; _structure[2]=tinyInfo[5];
+ _dxyz[0]=tinyInfoD[1]; _dxyz[1]=tinyInfoD[2]; _dxyz[2]=tinyInfoD[3];
+ _origin[0]=tinyInfoD[4]; _origin[1]=tinyInfoD[5]; _origin[2]=tinyInfoD[6];
+ declareAsNew();
+}
+
+void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
+{
+ checkCoherency();
+ std::ostringstream extent;
+ for(int i=0;i<3;i++)
+ {
+ if(i<_space_dim)
+ { extent << "0 " << _structure[i]-1 << " "; }
+ else
+ { extent << "0 0 "; }
+ }
+ ofs << " <" << getVTKDataSetType() << " WholeExtent=\"" << extent.str() << "\">\n";
+ ofs << " <Piece Extent=\"" << extent.str() << "\">\n";
+ ofs << " <PointData>\n" << pointData << std::endl;
+ ofs << " </PointData>\n";
+ ofs << " <CellData>\n" << cellData << std::endl;
+ ofs << " </CellData>\n";
+ ofs << " <Coordinates>\n";
+ ofs << " </Coordinates>\n";
+ ofs << " </Piece>\n";
+ ofs << " </" << getVTKDataSetType() << ">\n";
+}
+
+void MEDCouplingIMesh::reprQuickOverview(std::ostream& stream) const
+{
+ stream << "MEDCouplingIMesh C++ instance at " << this << ". Name : \"" << getName() << "\". Space dimension : " << _space_dim << ".";
+ if(_space_dim<0 || _space_dim>3)
+ return ;
+ stream << "\n";
+ std::ostringstream stream0,stream1;
+ int nbNodes(1),nbCells(0);
+ bool isPb(false);
+ for(int i=0;i<_space_dim;i++)
+ {
+ char tmp('X'+i);
+ int tmpNodes(_structure[i]);
+ stream1 << "- Axis " << tmp << " : " << tmpNodes << " nodes (orig=" << _origin[i] << ", inter=" << _dxyz[i] << ").";
+ if(i!=_space_dim-1)
+ stream1 << std::endl;
+ if(tmpNodes>=1)
+ nbNodes*=tmpNodes;
+ else
+ isPb=true;
+ if(tmpNodes>=2)
+ nbCells=nbCells==0?tmpNodes-1:nbCells*(tmpNodes-1);
+ }
+ if(!isPb)
+ {
+ stream0 << "Number of cells : " << nbCells << ", Number of nodes : " << nbNodes;
+ stream << stream0.str();
+ if(_space_dim>0)
+ stream << std::endl;
+ }
+ stream << stream1.str();
+}
+
+std::string MEDCouplingIMesh::getVTKDataSetType() const
+{
+ return std::string("ImageData");
+}
+
+std::vector<std::string> MEDCouplingIMesh::buildInfoOnComponents() const
+{
+ checkSpaceDimension();
+ int dim(getSpaceDimension());
+ std::vector<std::string> ret(dim);
+ for(int i=0;i<dim;i++)
+ {
+ std::ostringstream oss;
+ char tmp('X'+i); oss << tmp;
+ ret[i]=DataArray::BuildInfoFromVarAndUnit(oss.str(),_axis_unit);
+ }
+ return ret;
+}
+
+void MEDCouplingIMesh::checkSpaceDimension() const
+{
+ CheckSpaceDimension(_space_dim);
+}
+
+void MEDCouplingIMesh::CheckSpaceDimension(int spaceDim)
+{
+ if(spaceDim<0 || spaceDim>3)
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CheckSpaceDimension : input spaceDim must be in [0,1,2,3] !");
+}
+
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+
+#ifndef __PARAMEDMEM_MEDCOUPLINGIMESH_HXX__
+#define __PARAMEDMEM_MEDCOUPLINGIMESH_HXX__
+
+#include "MEDCoupling.hxx"
+#include "MEDCouplingStructuredMesh.hxx"
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingCMesh;
+
+ class MEDCouplingIMesh : public MEDCouplingStructuredMesh
+ {
+ public:
+ MEDCOUPLING_EXPORT static MEDCouplingIMesh *New();
+ MEDCOUPLING_EXPORT static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
+ const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
+ //
+ MEDCOUPLING_EXPORT void setSpaceDimension(int spaceDim);
+ MEDCOUPLING_EXPORT void setNodeStruct(const int *nodeStrctStart, const int *nodeStrctStop);
+ MEDCOUPLING_EXPORT std::vector<int> getNodeStruct() const;
+ MEDCOUPLING_EXPORT void setOrigin(const double *originStart, const double *originStop);
+ MEDCOUPLING_EXPORT std::vector<double> getOrigin() const;
+ MEDCOUPLING_EXPORT void setDXYZ(const double *dxyzStart, const double *dxyzStop);
+ MEDCOUPLING_EXPORT std::vector<double> getDXYZ() const;
+ MEDCOUPLING_EXPORT void setAxisUnit(const std::string& unitName);
+ MEDCOUPLING_EXPORT std::string getAxisUnit() const;
+ MEDCOUPLING_EXPORT double getMeasureOfAnyCell() const;
+ MEDCOUPLING_EXPORT MEDCouplingCMesh *convertToCartesian() const;
+ //
+ MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
+ MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return IMAGE_GRID; }
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const;
+ MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayInt *&cellCor) const;
+ MEDCOUPLING_EXPORT void checkCoherency() const;
+ MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT void checkCoherency2(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT int getSpaceDimension() const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
+ // tools
+ MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
+ MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
+ MEDCOUPLING_EXPORT void translate(const double *vector);
+ MEDCOUPLING_EXPORT void scale(const double *point, double factor);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true);
+ //some useful methods
+ MEDCOUPLING_EXPORT void getSplitCellValues(int *res) const;
+ MEDCOUPLING_EXPORT void getSplitNodeValues(int *res) const;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const;
+ MEDCOUPLING_EXPORT std::vector<int> getNodeGridStructure() const;
+ MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const;
+ //serialisation-unserialization
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+ private:
+ MEDCouplingIMesh();
+ MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCpy);
+ ~MEDCouplingIMesh();
+ void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ std::string getVTKDataSetType() const;
+ bool isEqualWithoutConsideringStrInternal(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ std::vector<std::string> buildInfoOnComponents() const;
+ void checkSpaceDimension() const;
+ static void CheckSpaceDimension(int spaceDim);
+ private:
+ int _space_dim;
+ double _origin[3];
+ double _dxyz[3];
+ int _structure[3];
+ std::string _axis_unit;
+ };
+}
+
+#endif
return info.substr(p1+1,p2-p1-1);
}
+/*!
+ * This method put in info format the result of the merge of \a var and \a unit.
+ * The standard format for that is "var [unit]".
+ * Inversely you can retrieve the var part or the unit part of info string using resp. GetVarNameFromInfo and GetUnitFromInfo.
+ */
+std::string DataArray::BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit)
+{
+ std::ostringstream oss;
+ oss << var << " [" << unit << "]";
+ return oss.str();
+}
+
/*!
* Returns a new DataArray by concatenating all given arrays, so that (1) the number
* of tuples in the result array is a sum of the number of tuples of given arrays and (2)
MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info);
MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info);
+ MEDCOUPLING_EXPORT static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit);
MEDCOUPLING_EXPORT static DataArray *Aggregate(const std::vector<const DataArray *>& arrs);
MEDCOUPLING_EXPORT virtual void reprStream(std::ostream& stream) const = 0;
MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const = 0;
*/
void MEDCouplingMesh::copyTinyInfoFrom(const MEDCouplingMesh *other)
{
- copyTinyStringsFrom(other);
_time=other->_time;
_iteration=other->_iteration;
_order=other->_order;
+ copyTinyStringsFrom(other);
}
/*!
EXTRUDED = 8,
CURVE_LINEAR = 9,
SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
- SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
+ SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
+ IMAGE_GRID = 12
} MEDCouplingMeshType;
// -- WARNING this enum must be synchronized with MEDCouplingCommon.i file ! --
MEDCoupling1SGTUMeshServant.cxx
MEDCoupling1GTUMeshServant.cxx
MEDCouplingCMeshServant.cxx
+ MEDCouplingIMeshServant.cxx
MEDCouplingUMeshServant.cxx
MEDCouplingFieldServant.cxx
MEDCouplingFieldDoubleServant.cxx
DataArrayDoubleClient.cxx
DataArrayIntClient.cxx
MEDCouplingCMeshClient.cxx
+ MEDCouplingIMeshClient.cxx
MEDCoupling1SGTUMeshClient.cxx
MEDCoupling1DGTUMeshClient.cxx
MEDCouplingCurveLinearMeshClient.cxx
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "MEDCouplingIMeshClient.hxx"
+#include "MEDCouplingMeshClient.hxx"
+#include "MEDCouplingIMesh.hxx"
+#include "MEDCouplingMemArray.hxx"
+
+#include <vector>
+
+using namespace ParaMEDMEM;
+
+MEDCouplingIMesh *MEDCouplingIMeshClient::New(SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr meshPtr)
+{
+ MEDCouplingIMesh *ret=MEDCouplingIMesh::New();
+ MEDCouplingMeshClient::fillMeshFromCorbaData(ret,meshPtr);
+ return ret;
+}
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+
+#ifndef __MEDCOUPLINGIMESHCLIENT_HXX__
+#define __MEDCOUPLINGIMESHCLIENT_HXX__
+
+#include "SALOMEconfig.h"
+#ifdef WIN32
+#define NOMINMAX
+#endif
+#include CORBA_SERVER_HEADER(MEDCouplingCorbaServant)
+#include "MEDCouplingClient.hxx"
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingIMesh;
+
+ class MEDCOUPLINGCLIENT_EXPORT MEDCouplingIMeshClient
+ {
+ public:
+ static MEDCouplingIMesh *New(SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr mesh);
+ };
+}
+
+#endif
#include "MEDCouplingMeshClient.hxx"
#include "MEDCouplingUMeshClient.hxx"
+#include "MEDCoupling1SGTUMeshClient.hxx"
+#include "MEDCoupling1DGTUMeshClient.hxx"
#include "MEDCouplingExtrudedMeshClient.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingCMeshClient.hxx"
+#include "MEDCouplingCurveLinearMeshClient.hxx"
+#include "MEDCouplingIMeshClient.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingCurveLinearMesh.hxx"
+#include "MEDCouplingIMesh.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
#include <vector>
CORBA::release(cmeshPtr);
return ret;
}
+ SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr clmeshPtr=SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface::_narrow(meshPtr);
+ if(!CORBA::is_nil(clmeshPtr))
+ {
+ MEDCouplingMesh *ret=MEDCouplingCurveLinearMeshClient::New(clmeshPtr);
+ CORBA::release(clmeshPtr);
+ return ret;
+ }
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr imeshPtr=SALOME_MED::MEDCouplingIMeshCorbaInterface::_narrow(meshPtr);
+ if(!CORBA::is_nil(imeshPtr))
+ {
+ MEDCouplingMesh *ret=MEDCouplingIMeshClient::New(imeshPtr);
+ CORBA::release(imeshPtr);
+ return ret;
+ }
+ SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr umeshPtr0=SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface::_narrow(meshPtr);
+ if(!CORBA::is_nil(umeshPtr0))
+ {
+ MEDCouplingMesh *ret=MEDCoupling1SGTUMeshClient::New(umeshPtr0);
+ CORBA::release(umeshPtr0);
+ return ret;
+ }
+ SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr umeshPtr1=SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface::_narrow(meshPtr);
+ if(!CORBA::is_nil(umeshPtr1))
+ {
+ MEDCouplingMesh *ret=MEDCoupling1DGTUMeshClient::New(umeshPtr1);
+ CORBA::release(umeshPtr1);
+ return ret;
+ }
return 0;
}
#include "MEDCouplingMeshServant.hxx"
#include "MEDCouplingUMeshServant.hxx"
#include "MEDCouplingCMeshServant.hxx"
+#include "MEDCouplingIMeshServant.hxx"
+#include "MEDCouplingCurveLinearMeshServant.hxx"
#include "MEDCouplingExtrudedMeshServant.hxx"
+#include "MEDCoupling1SGTUMeshServant.hxx"
+#include "MEDCoupling1DGTUMeshServant.hxx"
#include "MEDCouplingField.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingIMesh.hxx"
+#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
using namespace ParaMEDMEM;
SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
return ret;
}
+ const MEDCouplingIMesh *iMesh=dynamic_cast<const MEDCouplingIMesh *>(mesh);
+ if(iMesh)
+ {
+ MEDCouplingIMeshServant *retServ=new MEDCouplingIMeshServant(iMesh);
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
+ return ret;
+ }
const MEDCouplingExtrudedMesh *eMesh=dynamic_cast<const MEDCouplingExtrudedMesh *>(mesh);
if(eMesh)
{
MEDCouplingExtrudedMeshServant *retServ=new MEDCouplingExtrudedMeshServant(eMesh);
return retServ->_this();
}
+ const MEDCouplingCurveLinearMesh *clMesh=dynamic_cast<const MEDCouplingCurveLinearMesh *>(mesh);
+ if(clMesh)
+ {
+ MEDCouplingCurveLinearMeshServant *retServ=new MEDCouplingCurveLinearMeshServant(clMesh);
+ SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
+ return ret;
+ }
+ const MEDCoupling1SGTUMesh *u0Mesh=dynamic_cast<const MEDCoupling1SGTUMesh *>(mesh);
+ if(u0Mesh)
+ {
+ MEDCoupling1SGTUMeshServant *retServ=new MEDCoupling1SGTUMeshServant(u0Mesh);
+ SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
+ return ret;
+ }
+ const MEDCoupling1DGTUMesh *u1Mesh=dynamic_cast<const MEDCoupling1DGTUMesh *>(mesh);
+ if(u1Mesh)
+ {
+ MEDCoupling1DGTUMeshServant *retServ=new MEDCoupling1DGTUMeshServant(u1Mesh);
+ SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr ret=retServ->_this();//let this line even if it seems fool
+ return ret;
+ }
throw INTERP_KERNEL::Exception("Not dealt mesh type !");
}
SALOME_MED::MEDCouplingMeshCorbaInterface_ptr MEDCouplingFieldServant::getMesh()
{
- const MEDCouplingMesh *mesh=getPointer()->getMesh();
+ const MEDCouplingMesh *mesh(getPointer()->getMesh());
return BuildCorbaRefFromCppPointer(mesh);
}
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "MEDCouplingIMeshServant.hxx"
+
+#include "MEDCouplingIMesh.hxx"
+
+using namespace ParaMEDMEM;
+
+MEDCouplingIMeshServant::MEDCouplingIMeshServant(const MEDCouplingIMesh *cppPointerOfMesh):MEDCouplingStructuredMeshServant(cppPointerOfMesh)
+{
+}
+
+MEDCouplingIMeshServant::~MEDCouplingIMeshServant()
+{
+}
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __MEDCOUPLINGIMESHSERVANT_HXX__
+#define __MEDCOUPLINGIMESHSERVANT_HXX__
+
+#include "SALOMEconfig.h"
+
+#include CORBA_SERVER_HEADER(MEDCouplingCorbaServant)
+#include "MEDCouplingStructuredMeshServant.hxx"
+#include "MEDCouplingCorba.hxx"
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingIMesh;
+
+ class MEDCOUPLINGCORBA_EXPORT MEDCouplingIMeshServant : MEDCouplingStructuredMeshServant, public virtual POA_SALOME_MED::MEDCouplingIMeshCorbaInterface
+ {
+ public:
+ typedef MEDCouplingIMesh CppType;
+ MEDCouplingIMeshServant(const MEDCouplingIMesh *cppPointerOfMesh);
+ ~MEDCouplingIMeshServant();
+ private:
+ const MEDCouplingIMesh *getPointer() const { return (const MEDCouplingIMesh *)(_cpp_pointer); }
+ };
+}
+
+#endif
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingIMesh.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
#include <cmath>
//
return targetMesh;
}
+
+
+ ParaMEDMEM::MEDCouplingIMesh *MEDCouplingCorbaServBasicsTest::buildIMesh()
+ {
+ ParaMEDMEM::MEDCouplingIMesh *targetMesh(ParaMEDMEM::MEDCouplingIMesh::New());
+ targetMesh->setTime(2.3,4,5);
+ targetMesh->setTimeUnit("us");
+ targetMesh->setName("Example of IMesh");
+ targetMesh->setDescription("buildIMesh");
+ int ns[3]={6,7,8};
+ double orig[3]={4.25,3.75,-6.125};
+ double inter[3]={0.5,0.375,0.75};
+ targetMesh->setSpaceDimension(3);
+ targetMesh->setNodeStruct(ns,ns+3);
+ targetMesh->setOrigin(orig,orig+3);
+ targetMesh->setDXYZ(inter,inter+3);
+ targetMesh->setAxisUnit("mm");
+ return targetMesh;
+ }
ParaMEDMEM::MEDCouplingCurveLinearMesh *MEDCouplingCorbaServBasicsTest::buildCLMesh()
{
class MEDCoupling1DGTUMesh;
class MEDCoupling1SGTUMesh;
class MEDCouplingCMesh;
+ class MEDCouplingIMesh;
class MEDCouplingCurveLinearMesh;
class DataArrayDouble;
class DataArrayInt;
static ParaMEDMEM::MEDCouplingUMesh *buildM1DMesh();
static ParaMEDMEM::MEDCouplingExtrudedMesh *buildExtrudedMesh(ParaMEDMEM::MEDCouplingUMesh *&m2D);
static ParaMEDMEM::MEDCouplingCMesh *buildCMesh();
+ static ParaMEDMEM::MEDCouplingIMesh *buildIMesh();
static ParaMEDMEM::MEDCouplingCurveLinearMesh *buildCLMesh();
static ParaMEDMEM::MEDCoupling1SGTUMesh *build1SGTUMesh();
static ParaMEDMEM::MEDCoupling1DGTUMesh *build1DGTUMesh();
#include "MEDCouplingExtrudedMeshClient.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingCMeshClient.hxx"
+#include "MEDCouplingIMesh.hxx"
+#include "MEDCouplingIMeshClient.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDCouplingCurveLinearMeshClient.hxx"
#include "MEDCouplingFieldDouble.hxx"
meshFromDistant->decrRef();
}
+void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetchingIMesh()
+{
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr meshPtr=_objC->getIMesh();
+ ParaMEDMEM::MEDCouplingIMesh *meshFromDistant=ParaMEDMEM::MEDCouplingIMeshClient::New(meshPtr);
+ meshPtr->UnRegister();
+ CORBA::release(meshPtr);
+ ParaMEDMEM::MEDCouplingIMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildIMesh();
+ CPPUNIT_ASSERT(meshFromDistant->isEqual(meshRef,1e-12));
+ meshRef->decrRef();
+ meshFromDistant->decrRef();
+}
+
void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetchingCurveLinearMesh()
{
SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr meshPtr=_objC->getCLMesh();
CPPUNIT_TEST( checkCorbaFetchingM1D );
CPPUNIT_TEST( checkCorbaFetchingExtruded );
CPPUNIT_TEST( checkCorbaFetchingCMesh );
+ CPPUNIT_TEST( checkCorbaFetchingIMesh );
CPPUNIT_TEST( checkCorbaFetchingCurveLinearMesh );
CPPUNIT_TEST( checkCorbaFetching1SGTUMesh );
CPPUNIT_TEST( checkCorbaFetching1DGTUMesh );
void checkCorbaFetchingM1D();
void checkCorbaFetchingExtruded();
void checkCorbaFetchingCMesh();
+ void checkCorbaFetchingIMesh();
void checkCorbaFetchingCurveLinearMesh();
void checkCorbaFetching1SGTUMesh();
void checkCorbaFetching1DGTUMesh();
#include "MEDCoupling1SGTUMeshServant.hxx"
#include "MEDCoupling1DGTUMeshServant.hxx"
#include "MEDCouplingCMeshServant.hxx"
+#include "MEDCouplingIMeshServant.hxx"
#include "MEDCouplingUMeshServant.hxx"
#include "DataArrayDoubleServant.hxx"
#include "DataArrayIntServant.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingIMesh.hxx"
namespace SALOME_TEST
{
SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr ret=m->_this();
return ret;
}
+
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr MEDCouplingMeshFieldFactoryComponent::getIMesh()
+ {
+ ParaMEDMEM::MEDCouplingIMesh *m1=MEDCouplingCorbaServBasicsTest::buildIMesh();
+ ParaMEDMEM::MEDCouplingIMeshServant *m=new ParaMEDMEM::MEDCouplingIMeshServant(m1);
+ m1->decrRef();
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr ret=m->_this();
+ return ret;
+ }
SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr MEDCouplingMeshFieldFactoryComponent::getCLMesh()
{
SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr getM1DMesh();
SALOME_MED::MEDCouplingExtrudedMeshCorbaInterface_ptr getExtrudedMesh();
SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr getCMesh();
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_ptr getIMesh();
SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr getCLMesh();
SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr get1SGTUMesh();
SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr get1DGTUMesh();
#include "MEDCoupling1DGTUMeshClient.hxx"
#include "MEDCouplingExtrudedMeshClient.hxx"
#include "MEDCouplingCMeshClient.hxx"
+#include "MEDCouplingIMeshClient.hxx"
#include "MEDCouplingCurveLinearMeshClient.hxx"
#include "DataArrayDoubleClient.hxx"
#include "DataArrayIntClient.hxx"
%newobject ParaMEDMEM::MEDCoupling1DGTUMeshClient::New;
%newobject ParaMEDMEM::MEDCouplingExtrudedMeshClient::New;
%newobject ParaMEDMEM::MEDCouplingCMeshClient::New;
+%newobject ParaMEDMEM::MEDCouplingIMeshClient::New;
%newobject ParaMEDMEM::MEDCouplingCurveLinearMeshClient::New;
%newobject ParaMEDMEM::MEDCouplingMultiFieldsClient::New;
%newobject ParaMEDMEM::MEDCouplingFieldOverTimeClient::New;
Py_DECREF(iorMesh);
return MEDCouplingCMeshClient::New(meshPtrCppC2);
}
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_var meshPtrCppC7=SALOME_MED::MEDCouplingIMeshCorbaInterface::_narrow(meshPtrCpp);
+ if(!CORBA::is_nil(meshPtrCppC7))
+ {
+ Py_DECREF(pdict);
+ Py_DECREF(iorMesh);
+ return MEDCouplingIMeshClient::New(meshPtrCppC7);
+ }
SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_var meshPtrCppC3=SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface::_narrow(meshPtrCpp);
if(!CORBA::is_nil(meshPtrCppC3))
{
}
};
+ class MEDCouplingIMeshClient
+ {
+ public:
+ %extend
+ {
+ static MEDCouplingIMesh *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
+ {
+ PyObject* pdict=PyDict_New();
+ PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
+ PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
+ PyRun_String("import CORBA",Py_single_input,pdict, pdict);
+ PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
+ PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
+ // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+ PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
+ if(!iorMesh)
+ throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingIMeshClient.New appears to differ from CORBA reference ! Expecting a IMeshCorbaInterface CORBA reference !");
+ char *ior=PyString_AsString(iorMesh);
+ int argc=0;
+ CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
+ CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
+ SALOME_MED::MEDCouplingIMeshCorbaInterface_var meshPtrCppC=SALOME_MED::MEDCouplingIMeshCorbaInterface::_narrow(meshPtrCpp);
+ if(CORBA::is_nil(meshPtrCppC))
+ throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingIMeshInterface_ptr !");
+ Py_DECREF(pdict);
+ Py_DECREF(iorMesh);
+ MEDCouplingIMesh *ret=MEDCouplingIMeshClient::New(meshPtrCppC);
+ return ret;
+ }
+ }
+ };
+
class MEDCouplingCurveLinearMeshClient
{
public:
#include "MEDCoupling1DGTUMeshServant.hxx"
#include "MEDCouplingExtrudedMeshServant.hxx"
#include "MEDCouplingCMeshServant.hxx"
+#include "MEDCouplingIMeshServant.hxx"
#include "MEDCouplingCurveLinearMeshServant.hxx"
#include "DataArrayDoubleServant.hxx"
#include "DataArrayIntServant.hxx"
return buildServantAndActivate<MEDCouplingExtrudedMeshServant>(dynamic_cast<const MEDCouplingExtrudedMesh *>(cppPointerOfMesh));
if(dynamic_cast<const MEDCouplingCMesh *>(cppPointerOfMesh))
return buildServantAndActivate<MEDCouplingCMeshServant>(dynamic_cast<const MEDCouplingCMesh *>(cppPointerOfMesh));
+ if(dynamic_cast<const MEDCouplingIMesh *>(cppPointerOfMesh))
+ return buildServantAndActivate<MEDCouplingIMeshServant>(dynamic_cast<const MEDCouplingIMesh *>(cppPointerOfMesh));
if(dynamic_cast<const MEDCouplingCurveLinearMesh *>(cppPointerOfMesh))
return buildServantAndActivate<MEDCouplingCurveLinearMeshServant>(dynamic_cast<const MEDCouplingCurveLinearMesh *>(cppPointerOfMesh));
throw INTERP_KERNEL::Exception("MEDCouplingMeshServant::_this : unrecognized type (or not managed type) of Mesh in input !");
return buildServantAndActivate2<MEDCouplingExtrudedMeshServant>(dynamic_cast<const MEDCouplingExtrudedMesh *>(cppPointerOfMesh));
if(dynamic_cast<const MEDCouplingCMesh *>(cppPointerOfMesh))
return buildServantAndActivate2<MEDCouplingCMeshServant>(dynamic_cast<const MEDCouplingCMesh *>(cppPointerOfMesh));
+ if(dynamic_cast<const MEDCouplingIMesh *>(cppPointerOfMesh))
+ return buildServantAndActivate2<MEDCouplingIMeshServant>(dynamic_cast<const MEDCouplingIMesh *>(cppPointerOfMesh));
if(dynamic_cast<const MEDCouplingCurveLinearMesh *>(cppPointerOfMesh))
return buildServantAndActivate2<MEDCouplingCurveLinearMeshServant>(dynamic_cast<const MEDCouplingCurveLinearMesh *>(cppPointerOfMesh));
throw INTERP_KERNEL::Exception("MEDCouplingMeshServant::_this2 : unrecognized type (or not managed type) of Mesh in input !");
}
}
};
+
+ class MEDCouplingIMeshServant
+ {
+ public:
+ %extend
+ {
+ static PyObject *_this(const MEDCouplingIMesh *cppPointerOfMesh) throw(INTERP_KERNEL::Exception)
+ {
+ return buildServantAndActivate<MEDCouplingIMeshServant>(cppPointerOfMesh);
+ }
+
+ static PyObject *_this2(const MEDCouplingIMesh *cppPointerOfMesh) throw(INTERP_KERNEL::Exception)
+ {
+ return buildServantAndActivate2<MEDCouplingIMeshServant>(cppPointerOfMesh);
+ }
+ }
+ };
class MEDCouplingCurveLinearMeshServant
{
#
return targetMesh;
+ def buildIMesh(self):
+ targetMesh=MEDCouplingIMesh.New();
+ targetMesh.setTime(2.3,4,5);
+ targetMesh.setTimeUnit("us");
+ targetMesh.setName("Example of IMesh");
+ targetMesh.setDescription("buildIMesh");
+ #
+ targetMesh.setSpaceDimension(3);
+ targetMesh.setNodeStruct([6,7,8]);
+ targetMesh.setOrigin([4.25,3.75,-6.125]);
+ targetMesh.setDXYZ([0.5,0.375,0.75]);
+ targetMesh.setAxisUnit("mm");
+ #
+ return targetMesh
+
def buildCLMesh(self):
targetMesh=MEDCouplingCurveLinearMesh();
targetMesh.setTime(2.3,4,5);
mesh=self._test.buildCMesh()
return MEDCouplingCMeshServant._this(mesh)
+ def getIMesh(self):
+ mesh=self._test.buildIMesh()
+ return MEDCouplingIMeshServant._this(mesh)
+
def getCLMesh(self):
mesh=self._test.buildCLMesh()
return MEDCouplingCurveLinearMeshServant._this(mesh)
self.assertTrue(_mesh_from_distant.isEqual(meshRef,1e-12))
pass
+ def testCorbaFetchingIMesh(self):
+ meshPtr=self._objC.getIMesh();
+ _mesh_from_distant=MEDCouplingIMeshClient.New(meshPtr);
+ meshPtr.UnRegister();
+ test=MEDCouplingCorbaSwigTest.MEDCouplingCorbaServBasicsTest()
+ meshRef=test.buildIMesh();
+ self.assertTrue(_mesh_from_distant.isEqual(meshRef,1e-12))
+ pass
+
def testCorbaFetchingCLMesh(self):
meshPtr=self._objC.getCLMesh();
_mesh_from_distant=MEDCouplingCurveLinearMeshClient.New(meshPtr);
j,k,l=r
assert(inp.isEqual(DataArrayInt([a,b,c,d,e,f,g,h,i,j,k,l],4,3)))
pass
+
+ def testSwig2IMesh1(self):
+ """ 1st test of image grid mesh.
+ """
+ m=MEDCouplingIMesh()
+ self.assertEqual(m.getSpaceDimension(),-1)
+ self.assertEqual(1,len(m.__repr__().split("\n")))
+ self.assertEqual(6,len(m.__str__().split("\n")))
+ self.assertRaises(InterpKernelException,m.getNodeStruct)
+ self.assertRaises(InterpKernelException,m.getOrigin)
+ self.assertRaises(InterpKernelException,m.getDXYZ)
+ m.setSpaceDimension(3)
+ self.assertEqual(9,len(m.__str__().split("\n")))
+ self.assertEqual(4,len(m.__repr__().split("\n")))
+ self.assertEqual((0,0,0),m.getNodeStruct())
+ self.assertEqual((0.,0.,0.),m.getOrigin())
+ self.assertEqual((0.,0.,0.),m.getDXYZ())
+ self.assertRaises(InterpKernelException,m.setNodeStruct,[3,4])
+ m.setNodeStruct([3,4,2])
+ self.assertEqual((3,4,2),m.getNodeStruct())
+ m.setOrigin(DataArrayDouble([1.5,2.5,3.5]))
+ self.assertEqual((1.5,2.5,3.5),m.getOrigin())
+ m.setDXYZ((0.5,1.,0.25))
+ self.assertEqual((0.5,1.,0.25),m.getDXYZ())
+ for it in DataArrayDouble([(1.5,2.5,3.5)]):
+ m2=MEDCouplingIMesh("",3,DataArrayInt([3,4,2]),it,DataArrayDouble((0.5,1.,0.25)))
+ pass
+ self.assertEqual(3,m.getSpaceDimension())
+ self.assertEqual((3,4,2),m2.getNodeStruct())
+ self.assertEqual((1.5,2.5,3.5),m2.getOrigin())
+ self.assertEqual((0.5,1.,0.25),m2.getDXYZ())
+ self.assertEqual(24,m2.getNumberOfNodes())
+ self.assertEqual(6,m2.getNumberOfCells())
+ self.assertTrue(m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ m2.setAxisUnit("m")
+ self.assertTrue(not m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ m.setAxisUnit("m")
+ self.assertTrue(m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ m.setName("mesh")
+ self.assertTrue(not m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ m2.setName("mesh")
+ self.assertTrue(m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ m2.setTime(1.1,0,3)
+ self.assertTrue(not m.isEqual(m2,1e-12))
+ m.setTime(1.1,0,3)
+ self.assertTrue(m.isEqual(m2,1e-12))
+ m.setTimeUnit("ms")
+ self.assertTrue(not m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ m2.setTimeUnit("ms")
+ self.assertTrue(m.isEqual(m2,1e-12)) ; self.assertTrue(m.isEqualWithoutConsideringStr(m2,1e-12))
+ #
+ m2.setNodeStruct([3,2,4])
+ self.assertTrue(not m.isEqual(m2,1e-12))
+ m.setNodeStruct([3,2,4])
+ self.assertTrue(m.isEqual(m2,1e-12))
+ m.setOrigin(DataArrayDouble([1.5,3.5,2.5]))
+ self.assertTrue(not m.isEqual(m2,1e-12))
+ m2.setOrigin([1.5,3.5,2.5])
+ self.assertTrue(m.isEqual(m2,1e-12))
+ m.setDXYZ((0.5,0.25,1.))
+ self.assertTrue(not m.isEqual(m2,1e-12))
+ m2.setDXYZ(DataArrayDouble((0.5,0.25,1.)))
+ self.assertTrue(m.isEqual(m2,1e-12))
+ m2bis=m2.deepCpy()
+ self.assertTrue(m2bis.isEqual(m2,1e-12))
+ #
+ self.assertEqual(3,m.getMeshDimension())
+ self.assertAlmostEqual(0.125,m.getMeasureOfAnyCell(),16);
+ mu=MEDCoupling1SGTUMesh(m.buildUnstructured())
+ mu.checkCoherency2()
+ cooExp=DataArrayDouble([(1.5,3.5,2.5),(2,3.5,2.5),(2.5,3.5,2.5),(1.5,3.75,2.5),(2,3.75,2.5),(2.5,3.75,2.5),(1.5,3.5,3.5),(2,3.5,3.5),(2.5,3.5,3.5),(1.5,3.75,3.5),(2,3.75,3.5),(2.5,3.75,3.5),(1.5,3.5,4.5),(2,3.5,4.5),(2.5,3.5,4.5),(1.5,3.75,4.5),(2,3.75,4.5),(2.5,3.75,4.5),(1.5,3.5,5.5),(2,3.5,5.5),(2.5,3.5,5.5),(1.5,3.75,5.5),(2,3.75,5.5),(2.5,3.75,5.5)]) ; cooExp.setInfoOnComponents(["X [m]","Y [m]","Z [m]"])
+ self.assertTrue(isinstance(mu,MEDCoupling1SGTUMesh))
+ self.assertEqual(NORM_HEXA8,mu.getCellModelEnum())
+ self.assertTrue(mu.getCoords().isEqual(cooExp,1e-12))
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,3,4,7,6,9,10,2,1,4,5,8,7,10,11,7,6,9,10,13,12,15,16,8,7,10,11,14,13,16,17,13,12,15,16,19,18,21,22,14,13,16,17,20,19,22,23])))
+ bary=m.getBarycenterAndOwner()
+ baryExp=DataArrayDouble([(1.75,3.625,3),(2.25,3.625,3),(1.75,3.625,4),(2.25,3.625,4),(1.75,3.625,5),(2.25,3.625,5)]) ; baryExp.setInfoOnComponents(["X [m]","Y [m]","Z [m]"])
+ self.assertTrue(bary.isEqual(baryExp,1e-12))
+ #
+ c=m.convertToCartesian()
+ c.checkCoherency()
+ self.assertEqual([1.1,0,3],c.getTime())
+ self.assertEqual("ms",c.getTimeUnit())
+ self.assertEqual(3,c.getMeshDimension())
+ self.assertEqual(3,c.getSpaceDimension())
+ arrX=DataArrayDouble([1.5,2.,2.5]) ; arrX.setInfoOnComponents(["X [m]"])
+ self.assertTrue(c.getCoordsAt(0).isEqual(arrX,1e-12))
+ arrY=DataArrayDouble([3.5,3.75]) ; arrY.setInfoOnComponents(["Y [m]"])
+ self.assertTrue(c.getCoordsAt(1).isEqual(arrY,1e-12))
+ arrZ=DataArrayDouble([2.5,3.5,4.5,5.5]) ; arrZ.setInfoOnComponents(["Z [m]"])
+ self.assertTrue(c.getCoordsAt(2).isEqual(arrZ,1e-12))
+ self.assertTrue(c.buildUnstructured().isEqual(m.buildUnstructured(),1e-12))
+ #
+ a,b=m.getCellsContainingPoints(baryExp,1e-12)
+ self.assertTrue(a.isEqual(DataArrayInt([0,1,2,3,4,5])))
+ self.assertTrue(b.isEqual(DataArrayInt([0,1,2,3,4,5,6])))
+ for a,b in enumerate(baryExp):
+ self.assertEqual(a,m.getCellContainingPoint(b,1e-12))
+ pass
+ #
+ m.translate([1.,2.,4.])
+ self.assertEqual((3,2,4),m.getNodeStruct())
+ self.assertEqual((2.5,5.5,6.5),m.getOrigin())
+ self.assertEqual((0.5,0.25,1.),m.getDXYZ())
+ m.scale([0.,1.,3.],2.)
+ self.assertAlmostEqual(1.,m.getMeasureOfAnyCell(),16);
+ self.assertEqual((3,2,4),m.getNodeStruct())
+ self.assertEqual((5.,10.,10.),m.getOrigin())
+ self.assertEqual((1.,0.5,2.),m.getDXYZ())
+ #
+ f=m.getMeasureField(False)
+ f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(1.1,0,3) ; f2.setMesh(m) ; arr=DataArrayDouble(6) ; arr[:]=1. ; f2.setArray(arr) ; f2.setTimeUnit("ms")
+ f2.setName("MeasureOfMesh_mesh")
+ self.assertTrue(f.isEqual(f2,1e-12,1e-12))
+ #
+ m3=m.buildStructuredSubPart([(1,2),(0,1),(1,3)])
+ self.assertEqual((2,2,3),m3.getNodeStruct())
+ self.assertEqual((6.,10.,12.),m3.getOrigin())
+ self.assertEqual((1.,0.5,2.),m3.getDXYZ())
+ # now playing with 3D surf
+ m4=MEDCouplingIMesh("",3,DataArrayInt([3,1,4]),DataArrayDouble([1.5,2.5,3.5]),DataArrayDouble((0.5,1.,0.25))) ; m4.setAxisUnit("km")
+ self.assertEqual(3,m4.getSpaceDimension())
+ self.assertEqual(2,m4.getMeshDimension())
+ self.assertEqual(12,m4.getNumberOfNodes())
+ self.assertEqual(6,m4.getNumberOfCells())
+ mu=MEDCoupling1SGTUMesh(m4.buildUnstructured())
+ mu.checkCoherency2()
+ self.assertTrue(isinstance(mu,MEDCoupling1SGTUMesh))
+ self.assertEqual(NORM_QUAD4,mu.getCellModelEnum())
+ coordsExp=DataArrayDouble([(1.5,2.5,3.5),(2,2.5,3.5),(2.5,2.5,3.5),(1.5,2.5,3.75),(2,2.5,3.75),(2.5,2.5,3.75),(1.5,2.5,4),(2,2.5,4),(2.5,2.5,4),(1.5,2.5,4.25),(2,2.5,4.25),(2.5,2.5,4.25)]) ; coordsExp.setInfoOnComponents(["X [km]","Y [km]","Z [km]"])
+ self.assertTrue(mu.getCoords().isEqual(coordsExp,1e-12))
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,3,4,2,1,4,5,4,3,6,7,5,4,7,8,7,6,9,10,8,7,10,11])))
+ pass
def setUp(self):
pass
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingIMesh.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingField.hxx"
%newobject ParaMEDMEM::MEDCouplingCMesh::New;
%newobject ParaMEDMEM::MEDCouplingCMesh::clone;
%newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
+%newobject ParaMEDMEM::MEDCouplingIMesh::New;
+%newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
%newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
%newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
%newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
{
public:
- static MEDCouplingCMesh *New();
- static MEDCouplingCMesh *New(const std::string& meshName);
+ static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
+ static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
MEDCouplingCMesh *clone(bool recDeepCpy) const;
void setCoords(const DataArrayDouble *coordsX,
const DataArrayDouble *coordsY=0,
const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
%extend {
- MEDCouplingCMesh()
+ MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
{
return MEDCouplingCMesh::New();
}
- MEDCouplingCMesh(const std::string& meshName)
+ MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
{
return MEDCouplingCMesh::New(meshName);
}
class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
{
public:
- static MEDCouplingCurveLinearMesh *New();
- static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
+ static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
+ static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
%extend {
- MEDCouplingCurveLinearMesh()
+ MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
{
return MEDCouplingCurveLinearMesh::New();
}
- MEDCouplingCurveLinearMesh(const std::string& meshName)
+ MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
{
return MEDCouplingCurveLinearMesh::New(meshName);
}
};
//== MEDCouplingCurveLinearMesh End
+
+ //== MEDCouplingIMesh
+
+ class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
+ {
+ public:
+ static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
+ //
+ void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
+ std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
+ std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
+ std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
+ void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
+ std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
+ double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDCouplingIMesh()
+ {
+ return MEDCouplingIMesh::New();
+ }
+ static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
+ {
+ static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
+ static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
+ const int *nodeStrctPtr(0);
+ const double *originPtr(0),*dxyzPtr(0);
+ int sw,sz,val0;
+ std::vector<int> bb0;
+ nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
+ //
+ double val,val2;
+ std::vector<double> bb,bb2;
+ int sz1,sz2;
+ originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
+ dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
+ //
+ return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
+ }
+
+ MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
+ {
+ return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
+ }
+
+ void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
+ {
+ int sw,sz,val0;
+ std::vector<int> bb0;
+ const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
+ self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
+ }
+
+ void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
+ {
+ static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw,nbTuples;
+ const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
+ self->setOrigin(originPtr,originPtr+nbTuples);
+ }
+
+ void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
+ {
+ static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw,nbTuples;
+ const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
+ self->setDXYZ(originPtr,originPtr+nbTuples);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+ std::string __repr__() const throw(INTERP_KERNEL::Exception)
+ {
+ std::ostringstream oss;
+ self->reprQuickOverview(oss);
+ return oss.str();
+ }
+ }
+ };
+
+ //== MEDCouplingIMesh End
+
}
namespace ParaMEDMEM
static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
+ static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
void updateTime() const;
%extend
{
ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh,owner);
if(dynamic_cast<ParaMEDMEM::MEDCouplingCurveLinearMesh *>(mesh))
ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh,owner);
+ if(dynamic_cast<ParaMEDMEM::MEDCouplingIMesh *>(mesh))
+ ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingIMesh,owner);
if(!ret)
throw INTERP_KERNEL::Exception("Not recognized type of mesh on downcast !");
return ret;