using namespace ParaMEDMEM;
-MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::New(MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
+/*!
+ * Build an extruded mesh instance from 3D and 2D unstructured mesh lying on the \b same \b coords.
+ * @param mesh3D 3D unstructured mesh.
+ * @param mesh2D 2D unstructured mesh lying on the same coordinates than mesh3D. \b Warning mesh2D is \b not \b const
+ * because the mesh is aggregated and potentially modified by rotate or translate method.
+ * @param cell2DId Id of cell in mesh2D mesh where the computation of 1D mesh will be done.
+ */
+MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
{
return new MEDCouplingExtrudedMesh(mesh3D,mesh2D,cell2DId);
}
return EXTRUDED;
}
-MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
+MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
try:_mesh2D(mesh2D),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId)
{
if(_mesh2D!=0)
_mesh3D_ids->decrRef();
}
-void MEDCouplingExtrudedMesh::computeExtrusion(MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception)
+void MEDCouplingExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception)
{
const char errMsg1[]="2D mesh is empty unable to compute extrusion !";
const char errMsg2[]="Coords between 2D and 3D meshes are not the same ! Try MEDCouplingPointSet::tryToShareSameCoords method";
return 0;
}
-void MEDCouplingExtrudedMesh::computeExtrusionAlg(MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception)
+void MEDCouplingExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception)
{
_mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1);
int nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells();
class MEDCOUPLING_EXPORT MEDCouplingExtrudedMesh : public MEDCouplingMesh
{
public:
- static MEDCouplingExtrudedMesh *New(MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
MEDCouplingMeshType getType() const;
bool isStructured() const;
int getNumberOfCells() const;
DataArrayDouble *getCoordinatesAndOwner() const;
DataArrayDouble *getBarycenterAndOwner() const;
private:
- MEDCouplingExtrudedMesh(MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
- void computeExtrusion(MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception);
- void computeExtrusionAlg(MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception);
+ MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
+ void computeExtrusion(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception);
+ void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception);
void build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh,
const int *desc3D, const int *descIndx3D,
const int *revDesc3D, const int *revDescIndx3D,
_type->checkCoherencyBetween(_mesh,getArray());
}
+/*!
+ * Returns the accumulation (the sum) of comId_th component of each tuples of default array.
+ */
double MEDCouplingFieldDouble::accumulate(int compId) const
{
const double *ptr=getArray()->getConstPointer();
return ret;
}
+/*!
+ * Returns the accumulation (the sum) of all tuples of default array.
+ * The res is expected to be of size getNumberOfComponents().
+ */
void MEDCouplingFieldDouble::accumulate(double *res) const
{
const double *ptr=getArray()->getConstPointer();
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<double>());
}
+/*!
+ * Returns the accumulation (the sum) of comId_th component of each tuples weigthed by the field
+ * returns by getWeightingField relative of the _type of field of default array.
+ * This method is usefull to check the conservativity of interpolation method.
+ */
double MEDCouplingFieldDouble::measureAccumulate(int compId, bool isWAbs) const
{
if(!_mesh)
return ret;
}
+/*!
+ * Returns the accumulation (the sum) of each tuples weigthed by the field
+ * returns by getWeightingField relative of the _type of field of default array.
+ * This method is usefull to check the conservativity of interpolation method.
+ */
void MEDCouplingFieldDouble::measureAccumulate(bool isWAbs, double *res) const
{
if(!_mesh)
delete [] tmp;
}
+/*!
+ * This method is reserved for field lying on structured mesh spatial support. It returns the value of cell localized by (i,j,k)
+ * If spatial support is not structured mesh an exception will be thrown.
+ * @param res out array expected to be equal to size getNumberOfComponents()
+ */
void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const throw(INTERP_KERNEL::Exception)
{
const DataArrayDouble *arr=_time_discr->getArray();
_type->getValueOnPos(arr,_mesh,i,j,k,res);
}
+/*!
+ * Returns value of 'this' on default time of point 'spaceLoc' using spatial discretization.
+ * If 'point' is outside the spatial discretization of this an exception will be thrown.
+ */
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) const throw(INTERP_KERNEL::Exception)
{
const DataArrayDouble *arr=_time_discr->getArray();
_type->getValueOn(arr,_mesh,spaceLoc,res);
}
+/*!
+ * Returns value of 'this' on time 'time' of point 'spaceLoc' using spatial discretization.
+ * If 'time' is not covered by this->_time_discr an exception will be thrown.
+ * If 'point' is outside the spatial discretization of this an exception will be thrown.
+ */
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const throw(INTERP_KERNEL::Exception)
{
std::vector< const DataArrayDouble *> arrs=_time_discr->getArraysForTime(time);
_time_discr->getValueForTime(time,res2,res);
}
+/*!
+ * Applies a*x+b on 'compoId'th component of each cell.
+ */
void MEDCouplingFieldDouble::applyLin(double a, double b, int compoId)
{
_time_discr->applyLin(a,b,compoId);
}
+/*!
+ * Applyies the function specified by pointer 'func' on each tuples on all arrays contained in _time_discr.
+ * If '*func' returns false during one evaluation an exception will be thrown.
+ */
void MEDCouplingFieldDouble::applyFunc(int nbOfComp, FunctionToEvaluate func)
{
_time_discr->applyFunc(nbOfComp,func);
}
+/*!
+ * Applyies the function specified by the string repr 'func' on each tuples on all arrays contained in _time_discr.
+ * If '*func' fails in evaluation during one evaluation an exception will be thrown.
+ * The field will contain 'nbOfComp' components after the call.
+ */
void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func)
{
_time_discr->applyFunc(nbOfComp,func);
}
+/*!
+ * Applyies the function specified by the string repr 'func' on each tuples on all arrays contained in _time_discr.
+ * If '*func' fails in evaluation during one evaluation an exception will be thrown.
+ * The field will contain exactly the same number of components after the call.
+ */
void MEDCouplingFieldDouble::applyFunc(const char *func)
{
_time_discr->applyFunc(func);
void MEDCouplingFieldDouble::updateTime()
{
MEDCouplingField::updateTime();
- if(getArray())
- updateTimeWith(*getArray());
+ updateTimeWith(*_time_discr);
}
void MEDCouplingFieldDouble::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception)
return true;
}
+/*!
+ * This method builds a field lying on 'this' with 'nbOfComp' components.
+ * 'func' is a pointer that points to a function that takes 2 arrays in parameter and returns a boolean.
+ * The first array is a in-param of size this->getSpaceDimension and the second an out param of size 'nbOfComp'.
+ * The return field will have type specified by 't'. 't' is also used to determine where values of field will be
+ * evaluate.
+ * @param t type of field returned and specifies where the evaluation of func will be done.
+ * @param nbOfComp number of components of returned field.
+ * @param func pointer to a function that should return false if the evaluation failed. (division by 0. for example)
+ * @return field with counter = 1.
+ */
MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const
{
MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(t);
return ret;
}
+/*!
+ * This method builds a field lying on 'this' with 'nbOfComp' components.
+ * 'func' is a string that is the expression to evaluate.
+ * The return field will have type specified by 't'. 't' is also used to determine where values of field will be
+ * evaluate.
+ * @param t type of field returned and specifies where the evaluation of func will be done.
+ * @param nbOfComp number of components of returned field.
+ * @param func expression.
+ * @return field with counter = 1.
+ */
MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const
{
INTERP_KERNEL::ExprParser expr(func);
return ret;
}
+/*!
+ * retruns a newly created mesh with counter=1
+ * that is the union of mesh1 and mesh2 if possible. The cells of mesh2 will appear after cells of 'mesh1'. Idem for nodes.
+ */
MEDCouplingMesh *MEDCouplingMesh::mergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2)
{
return mesh1->mergeMyselfWith(mesh2);
return _coords;
}
+bool MEDCouplingPointSet::isEqual(const MEDCouplingMesh *other, double prec) const
+{
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ if(!otherC)
+ return false;
+ if(!MEDCouplingMesh::isEqual(other,prec))
+ return false;
+ if(!areCoordsEqual(*otherC,prec))
+ return false;
+ return true;
+}
+
bool MEDCouplingPointSet::areCoordsEqual(const MEDCouplingPointSet& other, double prec) const
{
if(_coords==0 && other._coords==0)
}
/*!
+ * This methods searches for each node n1 nodes in _coords that are less far than 'prec' from n1. if any these nodes are stored in params
+ * comm and commIndex.
* @param comm out parameter (not inout)
* @param commIndex out parameter (not inout)
*/
return ret;
}
+/*
+ * This method renumber 'this' using 'newNodeNumbers' array of size this->getNumberOfNodes.
+ * newNbOfNodes specifies the *std::max_element(newNodeNumbers,newNodeNumbers+this->getNumberOfNodes())
+ * This value is asked because often known by the caller of this method.
+ * @param newNodeNumbers array specifying the new numbering.
+ * @param newNbOfNodes the new number of nodes.
+ */
void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
{
DataArrayDouble *newCoords=DataArrayDouble::New();
newCoords->decrRef();
}
+/*!
+ * This method fills bbox params like that : bbox[0]=XMin, bbox[1]=XMax, bbox[2]=YMin...
+ * The returned bounding box is arranged along trihedron.
+ * @param bbox out array of size 2*this->getSpaceDimension().
+ */
void MEDCouplingPointSet::getBoundingBox(double *bbox) const
{
int dim=getSpaceDimension();
}
}
+/*!
+ * This method removes useless nodes in coords.
+ */
void MEDCouplingPointSet::zipCoords()
{
checkFullyDefined();
traducer->decrRef();
}
+/*!
+ * Non const method that operates a rotation of 'this'.
+ * If spaceDim==2 'vector' parameter is ignored (and could be 0) and the rotation is done around 'center' with angle specified by 'angle'.
+ * If spaceDim==3 the rotation axe is defined by ('center','vector') and the angle is 'angle'.
+ * @param center an array of size getSpaceDimension().
+ * @param vector in array of size getSpaceDimension().
+ * @param angle angle of rotation in radian.
+ */
void MEDCouplingPointSet::rotate(const double *center, const double *vector, double angle)
{
int spaceDim=getSpaceDimension();
updateTime();
}
+/*!
+ * Non const method that operates a translation of 'this'.
+ * @param vector in array of size getSpaceDimension().
+ */
void MEDCouplingPointSet::translate(const double *vector)
{
double *coords=_coords->getPointer();
updateTime();
}
+/*!
+ * Non const method that operates a scale on 'this' with 'point' as reference point of scale and with factor 'factor'.
+ * @param point in array of size getSpaceDimension().
+ * @param factor factor of the scaling
+ */
void MEDCouplingPointSet::scale(const double *point, double factor)
{
double *coords=_coords->getPointer();
updateTime();
}
-void MEDCouplingPointSet::tryToShareSameCoords(MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception)
+/*!
+ * This method try to substitute this->_coords with other._coords if arrays match.
+ * This method potentially modifies 'this' if it succeeds, otherway an exception is thrown.
+ */
+void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception)
{
if(_coords==other._coords)
return ;
throw INTERP_KERNEL::Exception("Other instance has no coords whereas current has !");
if(!_coords->isEqual(*other._coords,epsilon))
throw INTERP_KERNEL::Exception("Coords are not the same !");
+ setCoords(other._coords);
}
+/*!
+ * merge _coords arrays of m1 and m2 and returns the union. The returned instance is newly created with ref count == 1.
+ */
DataArrayDouble *MEDCouplingPointSet::mergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2)
{
int spaceDim=m1->getSpaceDimension();
return DataArrayDouble::aggregate(m1->getCoords(),m2->getCoords());
}
+/*!
+ * Factory to build new instance of instanciable subclasses of MEDCouplingPointSet.
+ * This method is used during unserialization process.
+ */
MEDCouplingPointSet *MEDCouplingPointSet::buildInstanceFromMeshType(MEDCouplingMeshType type)
{
switch(type)
}
}
+/*!
+ * First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process.
+ */
void MEDCouplingPointSet::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
if(_coords)
}
}
+/*!
+ * Third and final step of serialization process.
+ */
void MEDCouplingPointSet::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
{
if(_coords)
a2=0;
}
+/*!
+ * Second step of serialization process.
+ * @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
+ */
void MEDCouplingPointSet::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings)
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
}
}
+/*!
+ * Second and final unserialization process.
+ * @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
+ */
void MEDCouplingPointSet::unserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
setName(littleStrings[0].c_str());
}
-// =============================================
-// Intersect Bounding Box given 2 Bounding Boxes
-// =============================================
+/*!
+ * Intersect Bounding Box given 2 Bounding Boxes.
+ */
bool MEDCouplingPointSet::intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps)
{
double* bbtemp = new double[2*dim];
rotate3DAlg(center,vect,angle,nbNodes,coords);
}
+/*!
+ * Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in 'coords'
+ * around an axe ('center','vect') and with angle 'angle'.
+ */
void MEDCouplingPointSet::rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, double *coords)
{
double sina=sin(angle);
rotate2DAlg(center,angle,nbNodes,coords);
}
+/*!
+ * Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in 'coords'
+ * around the center point 'center' and with angle 'angle'.
+ */
void MEDCouplingPointSet::rotate2DAlg(const double *center, double angle, int nbNodes, double *coords)
{
double cosa=cos(angle);
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
};
+/*!
+ * res should be an empty vector before calling this method.
+ * This method returns all the node coordinates included in _coords which ids are in [startConn;endConn) and put it into 'res' vector.
+ * If spaceDim==3 a projection will be done for each nodes on the middle plane containing these all nodes in [startConn;endConn).
+ * And after each projected nodes are moved to Oxy plane in order to consider these nodes as 2D nodes.
+ */
void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *endConn, std::vector<double>& res) const
{
const double *coords=_coords->getConstPointer();
throw INTERP_KERNEL::Exception("Invalid spacedim for project2DCellOnXY !");
}
+/*!
+ * low level method that checks that the 2D cell is not a butterfly cell.
+ */
bool MEDCouplingPointSet::isButterfly2DCell(const std::vector<double>& res, bool isQuad)
{
int nbOfNodes=res.size()/2;
void setCoords(DataArrayDouble *coords);
DataArrayDouble *getCoords() const { return _coords; }
DataArrayDouble *getCoordinatesAndOwner() const;
+ bool isEqual(const MEDCouplingMesh *other, double prec) const;
bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged) = 0;
void findCommonNodes(DataArrayInt *&comm, DataArrayInt *&commIndex, double prec) const;
void rotate(const double *center, const double *vector, double angle);
void translate(const double *vector);
void scale(const double *point, double factor);
- void tryToShareSameCoords(MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
+ void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
static DataArrayDouble *mergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
static MEDCouplingPointSet *buildInstanceFromMeshType(MEDCouplingMeshType type);
static void rotate2DAlg(const double *center, double angle, int nbNodes, double *coords);
}
}
+void MEDCouplingTimeDiscretization::updateTime()
+{
+ if(_array)
+ updateTimeWith(*_array);
+}
+
bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const
{
if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
#define __MEDCOUPLINGTIMEDISCRETIZATION_HXX__
#include "MEDCoupling.hxx"
+#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "InterpKernelException.hxx"
class DataArrayDouble;
class TimeLabel;
- class MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization
+ class MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization : public TimeLabel
{
protected:
MEDCouplingTimeDiscretization();
MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy);
public:
+ void updateTime();
static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
declareAsNew();
}
+/*!
+ * Appends a cell in connectivity array.
+ * @param type type of cell to add.
+ * @param size number of nodes constituting this cell.
+ * @param nodalConnOfCell the connectivity of the cell to add.
+ */
void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell)
{
int *pt=_nodal_connec_index->getPointer();
pt[++_iterator]=idx+size+1;
}
+/*!
+ * Method to be called to cloture the insertion of cells using this->insertNextCell.
+ */
void MEDCouplingUMesh::finishInsertingCells()
{
const int *pt=_nodal_connec_index->getConstPointer();
_nodal_connec->reAlloc(idx);
_nodal_connec_index->reAlloc(_iterator+1);
_iterator=-1;
+ _nodal_connec->declareAsNew();
+ _nodal_connec_index->declareAsNew();
+ updateTime();
}
+/*!
+ * This method is a method that compares 'this' and 'other'.
+ * This method compares \b all attributes, even names and component names.
+ */
bool MEDCouplingUMesh::isEqual(const MEDCouplingMesh *other, double prec) const
{
- //checkFullyDefined();
const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
if(!otherC)
return false;
- //otherC->checkFullyDefined();
- if(!MEDCouplingMesh::isEqual(other,prec))
+ if(!MEDCouplingPointSet::isEqual(other,prec))
return false;
if(_mesh_dim!=otherC->_mesh_dim)
return false;
if(_types!=otherC->_types)
return false;
- if(!areCoordsEqual(*otherC,prec))
- return false;
if(_nodal_connec!=0 || otherC->_nodal_connec!=0)
if(_nodal_connec==0 || otherC->_nodal_connec==0)
return false;
return ret;
}
+/*!
+ * build a sub part of 'this'. This sub part is defined by the cell ids contained in the array in [start,end).
+ * @param start start of array containing the cell ids to keep.
+ * @param end end of array of cell ids to keep. \b WARNING end param is \b not included ! Idem STL standard definitions.
+ * @param keepCoords that specifies if you want or not to keep coords as this or zip it (see zipCoords)
+ */
MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const
{
if(getMeshDimension()!=-1)
return buildPartOfMySelf(&cellIdsKept[0],&cellIdsKept[0]+cellIdsKept.size(),true);
}
+/*!
+ * This method returns a mesh with meshDim=this->getMeshDimension()-1.
+ * This returned mesh contains cells that are linked with one and only one cell of this.
+ * @param keepCoords specifies if zipCoords is called on returned mesh before being returned.
+ * @return mesh with ref counter equal to 1.
+ */
MEDCouplingPointSet *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const
{
DataArrayInt *desc=DataArrayInt::New();
return ret;
}
+/*!
+ * This methods returns set of nodes lying on the boundary of this.
+ */
void MEDCouplingUMesh::findBoundaryNodes(std::vector<int>& nodes) const
{
DataArrayInt *desc=DataArrayInt::New();
meshDM1->decrRef();
}
+/*
+ * This method renumber 'this' using 'newNodeNumbers' array of size this->getNumberOfNodes.
+ * newNbOfNodes specifies the *std::max_element(newNodeNumbers,newNodeNumbers+this->getNumberOfNodes())
+ * This value is asked because often known by the caller of this method.
+ * @param newNodeNumbers array specifying the new numbering.
+ * @param newNbOfNodes the new number of nodes.
+ */
void MEDCouplingUMesh::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
{
MEDCouplingPointSet::renumberNodes(newNodeNumbers,newNbOfNodes);
node=newNodeNumbers[node];
}
}
+ _nodal_connec->declareAsNew();
+ updateTime();
}
/*!
delete [] elem_bb;
}
+/*!
+ * Returns the cell type of cell with id 'cellId'.
+ */
INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(int cellId) const
{
const int *ptI=_nodal_connec_index->getConstPointer();
return (INTERP_KERNEL::NormalizedCellType) pt[ptI[cellId]];
}
+/*!
+ * Appends the nodal connectivity in 'conn' of cell with id 'cellId'.
+ */
void MEDCouplingUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
{
const int *ptI=_nodal_connec_index->getConstPointer();
conn.push_back(*w);
}
+/*!
+ * Returns coordinates of node with id 'nodeId' and append it in 'coo'.
+ */
void MEDCouplingUMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
{
const double *cooPtr=_coords->getConstPointer();
return std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to<int>(),-1));
}
+/*!
+ * Method reserved for advanced users having prepared their connectivity before.
+ * Arrays 'conn' and 'connIndex' will be aggregated without any copy and their counter will be incremented.
+ */
void MEDCouplingUMesh::setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes)
{
DataArrayInt::setArrayIn(conn,_nodal_connec);
declareAsNew();
}
+/*!
+ * Copy constructor. If 'deepCpy' is false 'this' is a shallow copy of other.
+ * If 'deeCpy' is true all arrays (coordinates and connectivities) are deeply copied.
+ */
MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy):MEDCouplingPointSet(other,deepCpy),_iterator(-1),_mesh_dim(other._mesh_dim),
_nodal_connec(0),_nodal_connec_index(0),
_types(other._types)
_nodal_connec_index->decrRef();
}
+/*!
+ * This method recomputes all cell types of 'this'.
+ */
void MEDCouplingUMesh::computeTypes()
{
if(_nodal_connec && _nodal_connec_index)
return _mesh_dim;
}
+/*!
+ * This method is for test reason. Normally the integer returned is not useable by user.
+ */
int MEDCouplingUMesh::getMeshLength() const
{
return _nodal_connec->getNbOfElems();
}
+/*!
+ * First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process.
+ */
void MEDCouplingUMesh::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
MEDCouplingPointSet::getTinySerializationInformation(tinyInfo,littleStrings);
tinyInfo.push_back(-1);
}
+/*!
+ * First step of unserialization process.
+ */
bool MEDCouplingUMesh::isEmptyMesh(const std::vector<int>& tinyInfo) const
{
return tinyInfo[4]<=0;
}
/*!
+ * Second step of serialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
void MEDCouplingUMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings)
a1->alloc(tinyInfo[5]+tinyInfo[4]+1,1);
}
+/*!
+ * Third and final step of serialization process.
+ */
void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
{
MEDCouplingPointSet::serialize(a1,a2);
}
/*!
+ * Second and final unserialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
void MEDCouplingUMesh::unserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
}
}
+/*!
+ * This is the low algorithm of buildPartOfMySelf.
+ * Keeps from 'this' only cells which constituing point id are in the ids specified by ['start','end').
+ * The return newly allocated mesh will share the same coordinates as 'this'.
+ */
MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *start, const int *end) const
{
checkFullyDefined();
return field;
}
+/*!
+ * This methods returns a field on nodes and no time. This method is usefull to check "P1*" conservative interpolators.
+ * This field returns the getMeasureField of the dualMesh in P1 sens of 'this'.
+ */
MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) const
{
MEDCouplingFieldDouble *tmp=getMeasureField(isAbs);
return ret;
}
+/*!
+ * This methods returns a vector field on cells that represents the orthogonal vector normalized of each 2D cell of this.
+ * This method is only callable on mesh with meshdim == 2 and spacedim==2 or 3.
+ */
MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const
{
if(getMeshDimension()!=2)
return ret;
}
+/*!
+ * Returns a cell if any that contains the point located on 'pos' with precison eps.
+ * If 'pos' is outside 'this' -1 is returned. If several cells contain this point the cell with the smallest id is returned.
+ */
int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) const
{
std::vector<int> elts;
return elts.front();
}
+/*!
+ * Returns all cellIds in 'elts' of point 'pos' with eps accuracy.
+ */
void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
{
std::vector<int> eltsIndex;
return true;
}
+/*!
+ * Returns a newly created mesh (with ref count ==1) that contains merge of 'this' and 'other'.
+ */
MEDCouplingMesh *MEDCouplingUMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
{
if(other->getType()!=UNSTRUCTURED)
return mergeUMeshes(this,otherC);
}
+/*!
+ * Returns an array with this->getNumberOfCells() tuples and this->getSpaceDimension() dimension.
+ * The false barycenter is computed that is to say barycenter of a cell is computed using average on each
+ * components of coordinates of the cell.
+ */
DataArrayDouble *MEDCouplingUMesh::getBarycenterAndOwner() const
{
DataArrayDouble *ret=DataArrayDouble::New();
return ret;
}
+/*!
+ * Returns a newly created mesh (with ref count ==1) that contains merge of 'mesh1' and 'other'.
+ */
MEDCouplingUMesh *MEDCouplingUMesh::mergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2)
{
MEDCouplingUMesh *ret=MEDCouplingUMesh::New();