/*!
* \b Warning ! This method potentially modifies the underlying mesh ! If the mesh is shared by other fields, these fields could be unavailable.
*/
-bool MEDCouplingFieldDouble::mergeNodes(double eps)
+bool MEDCouplingFieldDouble::mergeNodes(double eps) throw(INTERP_KERNEL::Exception)
{
MEDCouplingPointSet *meshC=dynamic_cast<MEDCouplingPointSet *>((MEDCouplingMesh *)(_mesh));
if(!meshC)
void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
void serialize(std::vector<DataArrayDouble *>& arrays) const;
- bool mergeNodes(double eps);
+ bool mergeNodes(double eps) throw(INTERP_KERNEL::Exception);
static MEDCouplingFieldDouble *mergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const { return addFields(this,&other); }
const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other);
throw INTERP_KERNEL::Exception("A value 0.0 have been detected !");
}
-DataArrayDouble *DataArrayDouble::aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2)
+DataArrayDouble *DataArrayDouble::aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=a1->getNumberOfComponents();
if(nbOfComp!=a2->getNumberOfComponents())
return ret;
}
-DataArrayDouble *DataArrayDouble::add(const DataArrayDouble *a1, const DataArrayDouble *a2)
+DataArrayDouble *DataArrayDouble::add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=a1->getNumberOfComponents();
if(nbOfComp!=a2->getNumberOfComponents())
return ret;
}
-void DataArrayDouble::addEqual(const DataArrayDouble *other)
+void DataArrayDouble::addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=getNumberOfComponents();
if(nbOfComp!=other->getNumberOfComponents())
declareAsNew();
}
-DataArrayDouble *DataArrayDouble::substract(const DataArrayDouble *a1, const DataArrayDouble *a2)
+DataArrayDouble *DataArrayDouble::substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=a1->getNumberOfComponents();
if(nbOfComp!=a2->getNumberOfComponents())
return ret;
}
-void DataArrayDouble::substractEqual(const DataArrayDouble *other)
+void DataArrayDouble::substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=getNumberOfComponents();
if(nbOfComp!=other->getNumberOfComponents())
declareAsNew();
}
-DataArrayDouble *DataArrayDouble::multiply(const DataArrayDouble *a1, const DataArrayDouble *a2)
+DataArrayDouble *DataArrayDouble::multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
int nbOfTuple=a1->getNumberOfTuples();
int nbOfTuple2=a2->getNumberOfTuples();
return ret;
}
-void DataArrayDouble::multiplyEqual(const DataArrayDouble *other)
+void DataArrayDouble::multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
int nbOfTuple=getNumberOfTuples();
int nbOfTuple2=other->getNumberOfTuples();
declareAsNew();
}
-DataArrayDouble *DataArrayDouble::divide(const DataArrayDouble *a1, const DataArrayDouble *a2)
+DataArrayDouble *DataArrayDouble::divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=a1->getNumberOfComponents();
if(nbOfComp!=a2->getNumberOfComponents())
return ret;
}
-void DataArrayDouble::divideEqual(const DataArrayDouble *other)
+void DataArrayDouble::divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
int nbOfComp=getNumberOfComponents();
if(nbOfComp!=other->getNumberOfComponents())
MEDCOUPLING_EXPORT void useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT void writeOnPlace(int id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
MEDCOUPLING_EXPORT void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT static DataArrayDouble *aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2);
- MEDCOUPLING_EXPORT static DataArrayDouble *add(const DataArrayDouble *a1, const DataArrayDouble *a2);
- MEDCOUPLING_EXPORT void addEqual(const DataArrayDouble *other);
- MEDCOUPLING_EXPORT static DataArrayDouble *substract(const DataArrayDouble *a1, const DataArrayDouble *a2);
- MEDCOUPLING_EXPORT void substractEqual(const DataArrayDouble *other);
- MEDCOUPLING_EXPORT static DataArrayDouble *multiply(const DataArrayDouble *a1, const DataArrayDouble *a2);
- MEDCOUPLING_EXPORT void multiplyEqual(const DataArrayDouble *other);
- MEDCOUPLING_EXPORT static DataArrayDouble *divide(const DataArrayDouble *a1, const DataArrayDouble *a2);
- MEDCOUPLING_EXPORT void divideEqual(const DataArrayDouble *other);
+ MEDCOUPLING_EXPORT static DataArrayDouble *aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayDouble *add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayDouble *substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayDouble *multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayDouble *divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
//! nothing to do here because this class does not aggregate any TimeLabel instance.
MEDCOUPLING_EXPORT void updateTime() { }
private:
releaseData(false);
}
-int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method)
+int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception)
{
releaseData(true);
_src_mesh=(MEDCouplingMesh *)srcMesh; _target_mesh=(MEDCouplingMesh *)targetMesh;
}
}
-void MEDCouplingRemapper::transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue)
+void MEDCouplingRemapper::transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception)
{
if(_src_method!=srcField->getDiscretization()->getStringRepr())
throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field");
computeProduct(inputPointer,srcNbOfCompo,dftValue,resPointer);
}
-void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue)
+void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception)
{
if(_src_method!=srcField->getDiscretization()->getStringRepr())
throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field");
computeReverseProduct(inputPointer,trgNbOfCompo,dftValue,resPointer);
}
-MEDCouplingFieldDouble *MEDCouplingRemapper::transferField(const MEDCouplingFieldDouble *srcField, double dftValue)
+MEDCouplingFieldDouble *MEDCouplingRemapper::transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception)
{
if(_src_method!=srcField->getDiscretization()->getStringRepr())
throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field");
return ret;
}
-MEDCouplingFieldDouble *MEDCouplingRemapper::reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue)
+MEDCouplingFieldDouble *MEDCouplingRemapper::reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception)
{
if(_target_method!=targetField->getDiscretization()->getStringRepr())
throw INTERP_KERNEL::Exception("Incoherency with prepare call for target field");
return INTERP_KERNEL::InterpolationOptions::setOptionString(key,value);
}
-int MEDCouplingRemapper::prepareUU(const char *method)
+int MEDCouplingRemapper::prepareUU(const char *method) throw(INTERP_KERNEL::Exception)
{
MEDCouplingUMesh *src_mesh=(MEDCouplingUMesh *)_src_mesh;
MEDCouplingUMesh *target_mesh=(MEDCouplingUMesh *)_target_mesh;
return 1;
}
-int MEDCouplingRemapper::prepareEE(const char *method)
+int MEDCouplingRemapper::prepareEE(const char *method) throw(INTERP_KERNEL::Exception)
{
MEDCouplingExtrudedMesh *src_mesh=(MEDCouplingExtrudedMesh *)_src_mesh;
MEDCouplingExtrudedMesh *target_mesh=(MEDCouplingExtrudedMesh *)_target_mesh;
return computeDenoFromScratch(nat,srcField,trgField);
}
-void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField)
+void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) throw(INTERP_KERNEL::Exception)
{
_nature_of_deno=nat;
_time_deno_update=getTimeOfThis();
#include "MEDCouplingTimeLabel.hxx"
#include "InterpolationOptions.hxx"
#include "MEDCouplingNatureOfField.hxx"
+#include "InterpKernelException.hxx"
#include <map>
#include <vector>
public:
MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper();
MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper();
- MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method);
- MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue);
- MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue);
- MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue);
- MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue);
+ MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
MEDCOUPLINGREMAPPER_EXPORT bool setOptionInt(const std::string& key, int value);
MEDCOUPLINGREMAPPER_EXPORT bool setOptionDouble(const std::string& key, double value);
MEDCOUPLINGREMAPPER_EXPORT bool setOptionString(const std::string& key, std::string& value);
public:
MEDCOUPLINGREMAPPER_EXPORT static void printMatrix(const std::vector<std::map<int,double> >& m);
private:
- int prepareUU(const char *method);
- int prepareEE(const char *method);
+ int prepareUU(const char *method) throw(INTERP_KERNEL::Exception);
+ int prepareEE(const char *method) throw(INTERP_KERNEL::Exception);
void updateTime();
void releaseData(bool matrixSuppression);
void computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
- void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
+ void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) throw(INTERP_KERNEL::Exception);
void computeProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
void computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<int,double> >& m1D,
pass
def testMeshM1D(self):
meshM1D=MEDCouplingUMesh.New();
- ## CPPUNIT_ASSERT_THROW(meshM1D->getMeshDimension(),INTERP_KERNEL::Exception);
- ## CPPUNIT_ASSERT_THROW(meshM1D->getNumberOfNodes(),INTERP_KERNEL::Exception);
- ## CPPUNIT_ASSERT_THROW(meshM1D->getNumberOfCells(),INTERP_KERNEL::Exception);
- ## CPPUNIT_ASSERT_THROW(meshM1D->setMeshDimension(-2),INTERP_KERNEL::Exception);
- ## CPPUNIT_ASSERT_THROW(meshM1D->setMeshDimension(-10),INTERP_KERNEL::Exception);
- ## CPPUNIT_ASSERT_THROW(meshM1D->checkCoherency(),INTERP_KERNEL::Exception);
+ self.failUnlessRaises(Exception,meshM1D.getMeshDimension);
+ self.failUnlessRaises(Exception,meshM1D.getNumberOfNodes);
+ self.failUnlessRaises(Exception,meshM1D.getNumberOfCells);
+ self.failUnlessRaises(Exception,meshM1D.setMeshDimension,-2)
+ self.failUnlessRaises(Exception,meshM1D.setMeshDimension,-10)
meshM1D.setMeshDimension(-1);
meshM1D.checkCoherency();
self.failUnlessEqual(meshM1D.getMeshDimension(),-1);
self.failUnlessEqual(meshM1D.getNumberOfCells(),1);
- ## CPPUNIT_ASSERT_THROW(meshM1D.getNumberOfNodes(),INTERP_KERNEL::Exception);
- ## CPPUNIT_ASSERT_THROW(meshM1D.getSpaceDimension(),INTERP_KERNEL::Exception);
+ self.failUnlessRaises(Exception,meshM1D.getNumberOfNodes);
+ self.failUnlessRaises(Exception,meshM1D.getSpaceDimension);
cpy=meshM1D.clone(True);
self.failUnless(cpy.isEqual(meshM1D,1e-12));
fieldOnCells=MEDCouplingFieldDouble.New(ON_CELLS);
field.setNature(IntegralGlobConstraint);
field=MEDCouplingFieldDouble.New(ON_NODES,NO_TIME);
field.setNature(ConservativeVolumic);
- #self.failUnless_THROW(field.setNature(Integral),INTERP_KERNEL::Exception);
- #self.failUnless_THROW(field.setNature(IntegralGlobConstraint),INTERP_KERNEL::Exception);
+ self.failUnlessRaises(Exception,field.setNature,Integral);
+ self.failUnlessRaises(Exception,field.setNature,IntegralGlobConstraint);
pass
def testBuildSubMeshData(self):
self.failUnless(abs(0.5-values4[0])<1.e-12);
self.failUnless(abs(1.-values4[1])<1.e-12);
#
- ## self.failUnlessEqual_THROW(f1=m.fillFromAnalytic(ON_NODES,1,func3),Exception);
+ self.failUnlessRaises(Exception,m.fillFromAnalytic,ON_NODES,1,"1./(x-0.2)");
pass
def testFillFromAnalytic2(self):
f4.checkCoherency();
self.failUnlessEqual(f4.getTypeOfField(),ON_NODES);
self.failUnlessEqual(f4.getTimeDiscretization(),ONE_TIME);
- ## self.failUnlessEqual_THROW(f3=f1+f4,Exception);
+ self.failUnlessRaises(Exception,f1.__add__,f4);
f5=f4.buildNewTimeReprFromThis(NO_TIME,False);
self.failUnlessEqual(f5.getTypeOfField(),ON_NODES);
self.failUnlessEqual(f5.getTimeDiscretization(),NO_TIME);
f4.checkCoherency();
self.failUnlessEqual(f4.getTypeOfField(),ON_NODES);
self.failUnlessEqual(f4.getTimeDiscretization(),ONE_TIME);
- ## self.failUnlessEqual_THROW(f3=f1+f4,Exception);
+ self.failUnlessRaises(Exception,f1.__add__,f4);
f5=f4.buildNewTimeReprFromThis(NO_TIME,True);
self.failUnlessEqual(f5.getTypeOfField(),ON_NODES);
self.failUnlessEqual(f5.getTimeDiscretization(),NO_TIME);
pass
#
f1=m.buildOrthogonalField();
- ## self.failUnlessEqual_THROW(f2*=f1,INTERP_KERNEL::Exception);
+ # to avoid valgrind leaks
+ # self.failUnlessRaises(Exception,f2.__imul__,f1);
pass
def testOperationsOnFields4(self):
f1.setMesh(m);
array=DataArrayDouble.New();
f1.setArray(array);
- ## self.failUnlessEqual_THROW(f1.setEndArray(array),Exception);
- ## self.failUnlessEqual_THROW(f1.getEndArray(),Exception);
+ self.failUnlessRaises(Exception,f1.setEndArray,array);
+ self.failUnlessRaises(Exception,f1.getEndArray);
arr1=[0.,10.,20.,1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.]
arr2=[5.,15.,25.,6.,16.,26.,7.,17.,27.,8.,18.,28.,9.,19.,29.]
array.setValues(arr1,nbOfCells,3);
self.failUnless(abs(arr1[4]-res[1])<1.e-12);
self.failUnless(abs(arr1[5]-res[2])<1.e-12);
res=None
- ## self.failUnlessEqual_THROW(f1.getValueOn(pos,3.2,res),Exception);
+ self.failUnlessRaises(Exception,f1.getValueOn,pos,3.2)
f2=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
f2.setMesh(m);
f2.setArray(f1.getArray());
f2.setStartTime(2.,3,0);
f2.setEndTime(4.,13,0);
- ## self.failUnlessEqual_THROW(f2.checkCoherency(),Exception);
+ self.failUnlessRaises(Exception,f2.checkCoherency)
array2=DataArrayDouble.New();
array2.setValues(arr2,nbOfCells,3);
f2.setEndArray(array2);
f1=targetMesh.fillFromAnalytic(ON_NODES,1,"x+y+z");
tmp=f1.getArray()
tmp.setIJ(1,0,1000.);
- ## self.failUnlessEqual_THROW(f1.mergeNodes(1e-10),Exception);
+ self.failUnlessRaises(Exception,f1.mergeNodes,1.e-10)
pass
def testCheckConsecutiveCellTypes(self):
pass
def testGetValueOn1(self):
- # not implemented yet
targetMesh=MEDCouplingDataForTest.build2DTargetMesh_1();
fieldOnCells=MEDCouplingFieldDouble.New(ON_CELLS);
nbOfCells=targetMesh.getNumberOfCells();
pass
def testCMesh0(self):
- # not implemented yet
mesh=MEDCouplingCMesh.New();
coordsX=DataArrayDouble.New();
arrX=[ -1., 1., 2., 4. ]
m1=MEDCouplingDataForTest.build2DTargetMesh_1();
m2=MEDCouplingDataForTest.build2DSourceMesh_1();
#self.failUnlessEqual(m1.getCoords()!=m2.getCoords());
- ## self.failUnlessEqual_THROW(m1.tryToShareSameCoords(m2,1e-12),Exception);
+ self.failUnlessRaises(Exception,m1.tryToShareSameCoords,m2,1e-12)
pass
def testFindNodeOnPlane(self):
%newobject ParaMEDMEM::DataArrayDouble::performCpy;
%newobject ParaMEDMEM::DataArrayInt::deepCopy;
%newobject ParaMEDMEM::DataArrayInt::performCpy;
+%newobject ParaMEDMEM::DataArrayDouble::aggregate;
+%newobject ParaMEDMEM::DataArrayDouble::add;
+%newobject ParaMEDMEM::DataArrayDouble::substract;
+%newobject ParaMEDMEM::DataArrayDouble::multiply;
+%newobject ParaMEDMEM::DataArrayDouble::divide;
%newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
%newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
%newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
%newobject ParaMEDMEM::MEDCouplingCMesh::New;
%feature("unref") DataArrayDouble "$this->decrRef();"
%feature("unref") MEDCouplingPointSet "$this->decrRef();"
+%feature("unref") MEDCouplingMesh "$this->decrRef();"
%feature("unref") MEDCouplingUMesh "$this->decrRef();"
%feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
%feature("unref") MEDCouplingCMesh "$this->decrRef();"
%ignore ParaMEDMEM::MemArray::operator=;
%ignore ParaMEDMEM::MemArray::operator[];
%ignore ParaMEDMEM::MEDCouplingPointSet::getCoords();
-
+%rename (Exception) InterpKernelException;
%nodefaultctor;
+
+namespace INTERP_KERNEL
+{
+ class Exception
+ {
+ public:
+ Exception(const char* what);
+ ~Exception() throw ();
+ const char *what() const throw ();
+ };
+}
+
%include "MEDCouplingTimeLabel.hxx"
%include "MEDCouplingRefCountObject.hxx"
-%include "MEDCouplingMesh.hxx"
+
+namespace ParaMEDMEM
+{
+ typedef enum
+ {
+ UNSTRUCTURED = 5,
+ UNSTRUCTURED_DESC = 6,
+ CARTESIAN = 7,
+ EXTRUDED = 8
+ } MEDCouplingMeshType;
+
+ class DataArrayInt;
+ class DataArrayDouble;
+ class MEDCouplingFieldDouble;
+
+ class MEDCOUPLING_EXPORT MEDCouplingMesh : public RefCountObject, public TimeLabel
+ {
+ public:
+ void setName(const char *name) { _name=name; }
+ const char *getName() const { return _name.c_str(); }
+ virtual MEDCouplingMeshType getType() const = 0;
+ virtual bool isEqual(const MEDCouplingMesh *other, double prec) const { return _name==other->_name; }
+ virtual void checkCoherency() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual bool isStructured() const = 0;
+ virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual DataArrayDouble *getCoordinatesAndOwner() const = 0;
+ virtual DataArrayDouble *getBarycenterAndOwner() const = 0;
+ virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0;
+ virtual void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const = 0;
+ virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
+ // tools
+ virtual void getBoundingBox(double *bbox) const = 0;
+ virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0;
+ virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0;
+ virtual int getCellContainingPoint(const double *pos, double eps) const = 0;
+ virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
+ virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0;
+ virtual void rotate(const double *center, const double *vector, double angle) = 0;
+ virtual void translate(const double *vector) = 0;
+ virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual bool areCompatible(const MEDCouplingMesh *other) const;
+ static MEDCouplingMesh *mergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
+ };
+}
+
%include "MEDCouplingMemArray.hxx"
-%include "MEDCouplingMesh.hxx"
%include "NormalizedUnstructuredMesh.hxx"
%include "MEDCouplingNatureOfField.hxx"
%include "MEDCouplingTimeDiscretization.hxx"
public:
void updateTime();
bool isStructured() const;
- int getNumberOfNodes() const;
- int getSpaceDimension() const;
void setCoords(DataArrayDouble *coords);
DataArrayDouble *getCoordinatesAndOwner() const;
bool isEqual(const MEDCouplingMesh *other, double prec) const;
virtual MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const = 0;
virtual MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0;
virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0;
- virtual void findBoundaryNodes(std::vector<int>& nodes) const = 0;
virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0;
virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes);
virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const = 0;
MEDCouplingUMesh *clone(bool recDeepCpy) const;
void updateTime();
void checkCoherency() const throw(INTERP_KERNEL::Exception);
- void setMeshDimension(int meshDim);
+ void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
void allocateCells(int nbOfCells);
void finishInsertingCells();
void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
return convertIntArrToPyList2(elts);
}
- static PyObject *mergeUMeshesOnSameCoords(PyObject *ms)
+ static PyObject *mergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
{
std::vector<ParaMEDMEM::MEDCouplingUMesh *> meshes;
if(PyList_Check(ms))
}
void convertToPolyTypes(const std::vector<int>& cellIdsToConvert);
MEDCouplingUMesh *buildExtrudedMeshFromThis(const MEDCouplingUMesh *mesh1D, int policy);
- static MEDCouplingUMesh *mergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
+ static MEDCouplingUMesh *mergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
};
class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
{
public:
- virtual void checkCoherency() const;
+ virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
virtual bool areCompatible(const MEDCouplingField *other) const;
virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh);
TypeOfTimeDiscretization getTimeDiscretization() const;
void checkCoherency() const throw(INTERP_KERNEL::Exception);
double getIJ(int tupleId, int compoId) const;
- void setArray(DataArrayDouble *array);
- void setEndArray(DataArrayDouble *array);
- void setTime(double val, int dt, int it);
- void setStartTime(double val, int dt, int it);
- void setEndTime(double val, int dt, int it);
- DataArrayDouble *getArray() const;
- DataArrayDouble *getEndArray() const;
- void applyLin(double a, double b, int compoId);
+ void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
+ void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
+ void setTime(double val, int dt, int it) throw(INTERP_KERNEL::Exception);
+ void setStartTime(double val, int dt, int it) throw(INTERP_KERNEL::Exception);
+ void setEndTime(double val, int dt, int it) throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getArray() const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getEndArray() const throw(INTERP_KERNEL::Exception);
+ void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
int getNumberOfComponents() const;
int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
NatureOfField getNature() const { return _nature; }
void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
void updateTime();
- bool mergeNodes(double eps);
- void applyFunc(int nbOfComp, const char *func);
- void applyFunc(const char *func);
- double accumulate(int compId) const;
- double measureAccumulate(int compId, bool isWAbs) const;
- static MEDCouplingFieldDouble *mergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
- MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const;
- const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other);
- MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const;
- const MEDCouplingFieldDouble &operator-=(const MEDCouplingFieldDouble& other);
- MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const;
- const MEDCouplingFieldDouble &operator*=(const MEDCouplingFieldDouble& other);
- MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const;
- const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other);
+ bool mergeNodes(double eps) throw(INTERP_KERNEL::Exception);
+ void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
+ double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
+ double measureAccumulate(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *mergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ const MEDCouplingFieldDouble &operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ const MEDCouplingFieldDouble &operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
%extend {
- PyObject *getValueOn(PyObject *sl) const
+ PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
{
int sz;
double *spaceLoc=convertPyToNewDblArr2(sl,&sz);
sz=self->getNumberOfComponents();
double *res=new double[sz];
- self->getValueOn(spaceLoc,res);
+ try
+ {
+ self->getValueOn(spaceLoc,res);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ delete [] spaceLoc;
+ delete [] res;
+ throw e;
+ }
delete [] spaceLoc;
PyObject *ret=convertDblArrToPyList(res,sz);
delete [] res;
return ret;
}
- PyObject *getValueOn(PyObject *sl, double time) const
+ PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
{
int sz;
double *spaceLoc=convertPyToNewDblArr2(sl,&sz);
sz=self->getNumberOfComponents();
double *res=new double[sz];
- self->getValueOn(spaceLoc,time,res);
+ try
+ {
+ self->getValueOn(spaceLoc,time,res);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ delete [] spaceLoc;
+ delete [] res;
+ throw e;
+ }
delete [] spaceLoc;
PyObject *ret=convertDblArrToPyList(res,sz);
delete [] res;