const double& Bounds::operator[](int i) const
{
switch(i)
- {
+ {
case 0:
return _x_min;
case 1:
return _y_min;
case 3:
return _y_max;
- }
+ }
throw Exception("internal error occurs !");
}
double &Bounds::operator[](int i)
{
switch(i)
- {
+ {
case 0:
return _x_min;
case 1:
return _y_min;
case 3:
return _y_max;
- }
+ }
throw Exception("internal error occurs !");
}
|| (other._y_max < _y_min-QUADRATIC_PLANAR::_precision) )
return 0;
if( (other._x_min >= _x_max ) || (other._x_max <= _x_min) || (other._y_min >= _y_max) || (other._y_max <= _y_min) )
- return new Bounds(std::max(_x_min-QUADRATIC_PLANAR::_precision,other._x_min),
- std::min(_x_max+QUADRATIC_PLANAR::_precision,other._x_max),
- std::max(_y_min-QUADRATIC_PLANAR::_precision,other._y_min),
- std::min(_y_max+QUADRATIC_PLANAR::_precision,other._y_max));//In approx cases.
+ {
+ return new Bounds(std::max(_x_min-QUADRATIC_PLANAR::_precision,other._x_min),
+ std::min(_x_max+QUADRATIC_PLANAR::_precision,other._x_max),
+ std::max(_y_min-QUADRATIC_PLANAR::_precision,other._y_min),
+ std::min(_y_max+QUADRATIC_PLANAR::_precision,other._y_max));//In approx cases.
+ }
else
return new Bounds(std::max(_x_min,other._x_min),std::min(_x_max,other._x_max),std::max(_y_min,other._y_min),std::min(_y_max,other._y_max));
}
* Relative LOC
*/
typedef enum
- {
- IN = 0,
- OUT = 1,
- ON_BOUNDARY_POS = 2,
- ON_BOUNDARY_NEG = 3
- } Position;
-
+ {
+ IN = 0,
+ OUT = 1,
+ ON_BOUNDARY_POS = 2,
+ ON_BOUNDARY_NEG = 3
+ } Position;
+
class INTERPKERNEL_EXPORT Bounds
{
public:
unApplySimilarityOnMyNodes(xBary,yBary,fact);
other.unApplySimilarityOnMyNodesIfNotAlreadyHit(xBary,yBary,fact);
initEdgeHitStatus();
- other.initEdgeHitStatus();
+ other.initEdgeHitStatus();
unApplySimilarityOnMyEdges(xBary,yBary,fact);
other.unApplySimilarityOnMyEdgesIfNotAlreadyHit(xBary,yBary,fact);
}
applySimilarityOnMyNodes(xBary,yBary,dimChar);
other->applySimilarityOnMyNodesIfNotAlreadyHit(xBary,yBary,dimChar);
initEdgeHitStatus();
- other->initEdgeHitStatus();
+ other->initEdgeHitStatus();
applySimilarityOnMyEdges(xBary,yBary,dimChar);
other->applySimilarityOnMyEdgesIfNotAlreadyHit(xBary,yBary,dimChar);
}
}
void ComposedEdge::initNodeHitStatus() const
- {
+{
for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
(*iter)->getStartNode()->initHitStatus();
for(std::list< IntersectElement >::iterator iter2=listOfIntesc.begin();iter2!=listOfIntesc.end();iter2++)
if((*iter2).isIncludedByBoth())
inOutSwitch.insert(*iter2);
- }
+ }
//if overlapped we can forget
}
else
/*bool ComposedEdge::isInOrOut(Node *aNodeOn, Node *nodeToTest) const
{
-
+
EdgeInfLin *e1=new EdgeInfLin(aNodeOn,nodeToTest);
double ref=e1->getCharactValue(*nodeToTest);
set< IntersectElement > inOutSwitch;
using namespace INTERP_KERNEL;
MergePoints::MergePoints():_ass1Start1(0),_ass1End1(0),_ass1Start2(0),_ass1End2(0),
- _ass2Start1(0),_ass2End1(0),_ass2Start2(0),_ass2End2(0)
+ _ass2Start1(0),_ass2End1(0),_ass2Start2(0),_ass2End2(0)
{
}
IntersectElement::IntersectElement(double val1, double val2, bool start1, bool end1, bool start2, bool end2, Node *node
, const Edge& e1, const Edge& e2, bool keepOrder):_1S(keepOrder?start1:start2),
- _1E(keepOrder?end1:end2),
- _2S(keepOrder?start2:start1),
- _2E(keepOrder?end2:end1),
- _chararct_val_for_e1(keepOrder?val1:val2),
- _chararct_val_for_e2(keepOrder?val2:val1),
- _node(node),_loc_of_node(node->getLoc()),_e1(keepOrder?e1:e2),
- _e2(keepOrder?e2:e1)
+ _1E(keepOrder?end1:end2),
+ _2S(keepOrder?start2:start1),
+ _2E(keepOrder?end2:end1),
+ _chararct_val_for_e1(keepOrder?val1:val2),
+ _chararct_val_for_e2(keepOrder?val2:val1),
+ _node(node),_loc_of_node(node->getLoc()),_e1(keepOrder?e1:e2),
+ _e2(keepOrder?e2:e1)
{
}
IntersectElement::IntersectElement(const IntersectElement& other):_1S(other._1S),_1E(other._1E),_2S(other._2S),_2E(other._2E),
- _chararct_val_for_e1(other._chararct_val_for_e1),
- _chararct_val_for_e2(other._chararct_val_for_e2),_node(other._node),
- _loc_of_node(other._loc_of_node),_e1(other._e1), _e2(other._e2)
+ _chararct_val_for_e1(other._chararct_val_for_e1),
+ _chararct_val_for_e2(other._chararct_val_for_e2),_node(other._node),
+ _loc_of_node(other._loc_of_node),_e1(other._e1), _e2(other._e2)
{
if(_node)
_node->incrRef();
{
return _e1.isIn(_chararct_val_for_e1) && _e2.isIn(_chararct_val_for_e2);
}
-
+
bool EdgeIntersector::intersect(const Bounds *whereToFind, std::vector<Node *>& newNodes, bool& order, MergePoints& commonNode)
{
std::list< IntersectElement > listOfIntesc=getIntersectionsCharacteristicVal();
* Locates 'node' regarding edge this->_e1. If node is located close to (with distant lt epsilon) start or end point of _e1,
* 'node' takes its place. In this case 'obvious' is set to true and 'commonNode' stores information of merge point and finally 'where' is set.
* Furthermore 'node' is declared as ON LIMIT to indicate in locating process that an absolute location computation will have to be done.
- * If 'node' is not close to start or end point of _e1, 'obvious' is set to false and 'commonNode' and 'where' are let unchanged.
+ * If 'node' is not close to start or end point of _e1, 'obvious' is set to false and 'commonNode' and 'where' are let unchanged.
*/
void EdgeIntersector::obviousCaseForCurvAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode, bool& obvious) const
{
void Edge::fillXfigStreamForLoc(std::ostream& stream) const
{
switch(_loc)
- {
+ {
case FULL_IN_1:
stream << '2';//Green
break;
break;
default:
stream << '0';
- }
+ }
}
bool Edge::changeStartNodeWith(Node *otherStartNode) const
e2->dynCastFunction(tmp1,tmp2);
type1|=type2;
switch(type1)
- {
+ {
case 1:// Intersection seg/seg
ret=new SegSegIntersector((const EdgeLin &)(*e1),(const EdgeLin &)(*e2));
break;
default:
//Should never happen
throw Exception("A non managed association of edge has been detected. Go work for intersection computation implementation.");
- }
+ }
return ret;
}
{
Edge *tmp;
switch(code)
- {
+ {
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+START: // OUT_BEFORE - START
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_BEFORE: // OUT_BEFORE - OUT_BEFORE
case OUT_AFTER*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // OUT_AFTER - OUT_AFTER
case END*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // END - OUT_AFTER
case END*OFFSET_FOR_TYPEOFLOCINEDGE+START: // END - START
- return false;
+ return false;
case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // INSIDE - OUT_AFTER
- outVal1.pushBack(e1->buildEdgeLyingOnMe(e1->getStartNode(),nS,true));
- tmp=e1->buildEdgeLyingOnMe(nS,e1->getEndNode()); tmp->incrRef();
- outVal1.pushBack(tmp);
- outVal2.resize(2);
- outVal2.setValueAt(direction?0:1,tmp,direction); tmp->declareOn();
- outVal2.setValueAt(direction?1:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
- return true;
+ outVal1.pushBack(e1->buildEdgeLyingOnMe(e1->getStartNode(),nS,true));
+ tmp=e1->buildEdgeLyingOnMe(nS,e1->getEndNode()); tmp->incrRef();
+ outVal1.pushBack(tmp);
+ outVal2.resize(2);
+ outVal2.setValueAt(direction?0:1,tmp,direction); tmp->declareOn();
+ outVal2.setValueAt(direction?1:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
+ return true;
case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+INSIDE: // INSIDE - INSIDE
- {
- if(!e2->isIn(e2->getCharactValue(*(e1->getStartNode()))))
- {
- e2->incrRef(); e2->incrRef();
- outVal1.resize(3);
- outVal1.setValueAt(0,e1->buildEdgeLyingOnMe(e1->getStartNode(),nS));
- outVal1.setValueAt(1,const_cast<Edge*>(e2),direction);
- outVal1.setValueAt(2,e1->buildEdgeLyingOnMe(nE,e1->getEndNode()));
- outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
- return true;
- }
- else
- {
- outVal1.resize(3);
- outVal2.resize(3);
- tmp=e1->buildEdgeLyingOnMe(e1->getStartNode(),nE); tmp->incrRef(); tmp->declareOn();
- outVal1.setValueAt(0,tmp,true); outVal2.setValueAt(direction?2:0,tmp,direction);
- outVal1.setValueAt(1,e1->buildEdgeLyingOnMe(nE,nS));
- tmp=e1->buildEdgeLyingOnMe(nS,e1->getEndNode()); tmp->incrRef(); tmp->declareOn();
- outVal1.setValueAt(2,tmp,true); outVal2.setValueAt(direction?0:2,tmp,direction);
- tmp=e1->buildEdgeLyingOnMe(e1->getEndNode(),e1->getStartNode());
- outVal2.setValueAt(1,tmp,direction);
- return true;
- }
- }
+ {
+ if(!e2->isIn(e2->getCharactValue(*(e1->getStartNode()))))
+ {
+ e2->incrRef(); e2->incrRef();
+ outVal1.resize(3);
+ outVal1.setValueAt(0,e1->buildEdgeLyingOnMe(e1->getStartNode(),nS));
+ outVal1.setValueAt(1,const_cast<Edge*>(e2),direction);
+ outVal1.setValueAt(2,e1->buildEdgeLyingOnMe(nE,e1->getEndNode()));
+ outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
+ return true;
+ }
+ else
+ {
+ outVal1.resize(3);
+ outVal2.resize(3);
+ tmp=e1->buildEdgeLyingOnMe(e1->getStartNode(),nE); tmp->incrRef(); tmp->declareOn();
+ outVal1.setValueAt(0,tmp,true); outVal2.setValueAt(direction?2:0,tmp,direction);
+ outVal1.setValueAt(1,e1->buildEdgeLyingOnMe(nE,nS));
+ tmp=e1->buildEdgeLyingOnMe(nS,e1->getEndNode()); tmp->incrRef(); tmp->declareOn();
+ outVal1.setValueAt(2,tmp,true); outVal2.setValueAt(direction?0:2,tmp,direction);
+ tmp=e1->buildEdgeLyingOnMe(e1->getEndNode(),e1->getStartNode());
+ outVal2.setValueAt(1,tmp,direction);
+ return true;
+ }
+ }
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+INSIDE: // OUT_BEFORE - INSIDE
+ {
tmp=e1->buildEdgeLyingOnMe(e1->getStartNode(),nE); tmp->incrRef();
outVal1.pushBack(tmp);
outVal1.pushBack(e1->buildEdgeLyingOnMe(nE,e1->getEndNode()));
outVal2.setValueAt(direction?0:1,e1->buildEdgeLyingOnMe(nS,e1->getStartNode(),direction));
outVal2.setValueAt(direction?1:0,tmp,direction); tmp->declareOn();
return true;
+ }
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // OUT_BEFORE - OUT_AFTER
+ {
e1->incrRef(); e1->incrRef();
outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.resize(3);
outVal2.setValueAt(1,const_cast<Edge*>(e1),direction); e1->declareOn();
outVal2.setValueAt(direction?2:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
return true;
+ }
case START*OFFSET_FOR_TYPEOFLOCINEDGE+END: // START - END
+ {
e1->incrRef(); e1->incrRef();
outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.pushBack(const_cast<Edge*>(e1),direction); e1->declareOn();
return true;
+ }
case START*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // START - OUT_AFTER
+ {
e1->incrRef(); e1->incrRef();
outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.resize(2);
outVal2.setValueAt(direction?0:1,const_cast<Edge*>(e1),direction); e1->declareOn();
outVal2.setValueAt(direction?1:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
return true;
+ }
case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+END: // INSIDE - END
+ {
e2->incrRef(); e2->incrRef();
outVal1.pushBack(e1->buildEdgeLyingOnMe(e1->getStartNode(),nS,true));
outVal1.pushBack(const_cast<Edge*>(e2),direction);
outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
return true;
+ }
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+END: // OUT_BEFORE - END
+ {
e1->incrRef(); e1->incrRef();
outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.resize(2);
outVal2.setValueAt(direction?0:1,e1->buildEdgeLyingOnMe(nS,e1->getStartNode(),direction));
outVal2.setValueAt(direction?1:0,const_cast<Edge*>(e1),direction); e1->declareOn();
return true;
+ }
case START*OFFSET_FOR_TYPEOFLOCINEDGE+INSIDE: // START - INSIDE
+ {
e2->incrRef(); e2->incrRef();
outVal1.pushBack(const_cast<Edge*>(e2),direction);
outVal1.pushBack(e1->buildEdgeLyingOnMe(nE,e1->getEndNode()));
outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
return true;
+ }
case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+START: // INSIDE - START
+ {
outVal1.resize(2);
outVal2.resize(2);
tmp=e1->buildEdgeLyingOnMe(nS,e1->getEndNode()); tmp->incrRef(); tmp->declareOn();
outVal2.setValueAt(direction?0:1,tmp,direction);
outVal2.setValueAt(direction?1:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
return true;
+ }
case END*OFFSET_FOR_TYPEOFLOCINEDGE+INSIDE: // END - INSIDE
+ {
outVal1.resize(2);
outVal2.resize(2);
tmp=e1->buildEdgeLyingOnMe(e1->getStartNode(),nE); tmp->incrRef(); tmp->declareOn();
outVal2.setValueAt(direction?0:1,e1->buildEdgeLyingOnMe(e1->getEndNode(),e1->getStartNode(),direction));
outVal2.setValueAt(direction?1:0,tmp,direction);
return true;
+ }
default:
throw Exception("Unexpected situation of overlapping edges : internal error occurs ! ");
- }
+ }
}
bool Edge::isEqual(const Edge& other) const
namespace INTERP_KERNEL
{
typedef enum
- {
- SEG = 1,
- ARC_CIRCLE = 4,
- ARC_PARABOL = 8
- } TypeOfFunction;
+ {
+ SEG = 1,
+ ARC_CIRCLE = 4,
+ ARC_PARABOL = 8
+ } TypeOfFunction;
typedef enum
- {
- CIRCLE = 0 ,
- PARABOL = 1
- } TypeOfMod4QuadEdge;
+ {
+ CIRCLE = 0 ,
+ PARABOL = 1
+ } TypeOfMod4QuadEdge;
typedef enum
- {
- START = 5,
- END = 1,
- INSIDE = 2,
- OUT_BEFORE = 3,
- OUT_AFTER = 4
- } TypeOfLocInEdge; //see Edge::OFFSET_FOR_TYPEOFLOCINEDGE
-
+ {
+ START = 5,
+ END = 1,
+ INSIDE = 2,
+ OUT_BEFORE = 3,
+ OUT_AFTER = 4
+ } TypeOfLocInEdge; //see Edge::OFFSET_FOR_TYPEOFLOCINEDGE
+
typedef enum
- {
- FULL_IN_1 = 1,
- FULL_ON_1 = 4,
- FULL_OUT_1 = 2,
- FULL_UNKNOWN = 3
- } TypeOfEdgeLocInPolygon;
+ {
+ FULL_IN_1 = 1,
+ FULL_ON_1 = 4,
+ FULL_OUT_1 = 2,
+ FULL_UNKNOWN = 3
+ } TypeOfEdgeLocInPolygon;
class INTERPKERNEL_EXPORT MergePoints
{
_dy=(*(_e2.getEndNode()))[1]-(*(_e2.getStartNode()))[1];
_drSq=_dx*_dx+_dy*_dy;
_cross=
- ((*(_e2.getStartNode()))[0]-center[0])*((*(_e2.getEndNode()))[1]-center[1])-
- ((*(_e2.getStartNode()))[1]-center[1])*((*(_e2.getEndNode()))[0]-center[0]);
+ ((*(_e2.getStartNode()))[0]-center[0])*((*(_e2.getEndNode()))[1]-center[1])-
+ ((*(_e2.getStartNode()))[1]-center[1])*((*(_e2.getEndNode()))[0]-center[0]);
_determinant=getE1().getRadius()*getE1().getRadius()/_drSq-_cross*_cross/(_drSq*_drSq);
if(_determinant>-2*QUADRATIC_PLANAR::_precision)//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
obviousNoIntersection=false;
* @param deltaAngle in ]-2.*Pi;2.*Pi[
*/
EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle(deltaAngle),
- _angle0(angle0),_radius(radius)
+ _angle0(angle0),_radius(radius)
{
_center[0]=center[0];
_center[1]=center[1];
angleInRad0=GetAbsoluteAngleOfNormalizedVect((start[0]-center[0])/radius,(start[1]-center[1])/radius);
double angleInRadM=GetAbsoluteAngleOfNormalizedVect((middle[0]-center[0])/radius,(middle[1]-center[1])/radius);
angleInRad=GetAbsoluteAngleOfNormalizedVect(((start[0]-center[0])*(end[0]-center[0])+(start[1]-center[1])*(end[1]-center[1]))/(radius*radius),
- ((start[0]-center[0])*(end[1]-center[1])-(start[1]-center[1])*(end[0]-center[0]))/(radius*radius));
+ ((start[0]-center[0])*(end[1]-center[1])-(start[1]-center[1])*(end[0]-center[0]))/(radius*radius));
if(IsAngleNotIn(angleInRad0,angleInRad,angleInRadM))
angleInRad=angleInRad<0?2*M_PI+angleInRad:angleInRad-2*M_PI;
}
double tmp3=cos(angle1);
double tmp4=cos(_angle0);
bary[0]=_radius*x0*y0*(tmp4-tmp3)+_radius*_radius*(y0*(cos(2*_angle0)-cos(2*angle1))/4.+
- x0*(_angle/2.+(sin(2.*_angle0)-sin(2.*angle1))/4.))
- +tmp2*(tmp1*tmp1*tmp1-tmp0*tmp0*tmp0)/3.;
+ x0*(_angle/2.+(sin(2.*_angle0)-sin(2.*angle1))/4.))
+ +tmp2*(tmp1*tmp1*tmp1-tmp0*tmp0*tmp0)/3.;
bary[1]=y0*y0*_radius*(tmp4-tmp3)/2.+_radius*_radius*y0*(_angle/2.+(sin(2.*_angle0)-sin(2.*angle1))/4.)
- +tmp2*(tmp4-tmp3+(tmp3*tmp3*tmp3-tmp4*tmp4*tmp4)/3.)/2.;
+ +tmp2*(tmp4-tmp3+(tmp3*tmp3*tmp3-tmp4*tmp4*tmp4)/3.)/2.;
}
void EdgeArcCircle::getMiddleOfPoints(const double *p1, const double *p2, double *mid) const
double _cross;
double _determinant;
};
-
+
class INTERPKERNEL_EXPORT EdgeArcCircle : public Edge
{
public:
bool i_2S=_e2.getStartNode()->isEqual(*node);
bool i_2E=_e2.getEndNode()->isEqual(*node);
ret.push_back(IntersectElement(_e1.getCharactValue(*node),
- _e2.getCharactValue(*node),
- i_1S,i_1E,i_2S,i_2E,node,_e1,_e2,keepOrder()));
+ _e2.getCharactValue(*node),
+ i_1S,i_1E,i_2S,i_2E,node,_e1,_e2,keepOrder()));
return ret;
}
namespace INTERP_KERNEL
{
class INTERPKERNEL_EXPORT SegSegIntersector : SameTypeEdgeIntersector
- {
- friend class Edge;
- public:
- SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
- bool areColinears() const;
- bool haveTheySameDirection() const;
- void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
- void areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped);
- std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
- private:
- void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
- private:
- //! index on which all single index op will be performed. Filled in case colinearity is equal to true.
- int _ind;
- double _col[2];
- double _matrix[4];//SPACEDIM*SPACEDIM
- };
+ {
+ friend class Edge;
+ public:
+ SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
+ bool areColinears() const;
+ bool haveTheySameDirection() const;
+ void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
+ void areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped);
+ std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
+ private:
+ void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
+ private:
+ //! index on which all single index op will be performed. Filled in case colinearity is equal to true.
+ int _ind;
+ double _col[2];
+ double _matrix[4];//SPACEDIM*SPACEDIM
+ };
class INTERPKERNEL_EXPORT EdgeLin : public Edge
{
namespace INTERP_KERNEL
{
typedef enum
- {
- IN_1 = 7,
- ON_1 = 8,
- ON_LIM_1 = 12,
- ON_TANG_1 = 9,
- OUT_1 = 10,
- UNKNOWN = 11
- } TypeOfLocInPolygon;
+ {
+ IN_1 = 7,
+ ON_1 = 8,
+ ON_LIM_1 = 12,
+ ON_TANG_1 = 9,
+ OUT_1 = 10,
+ UNKNOWN = 11
+ } TypeOfLocInPolygon;
class Bounds;
-
+
/*!
* Representation of a 2D point, and potentially its location relative to a polygon.
* As nodes can be shared between edges it is handled with ref counting.
std::ifstream stream(file);
stream.exceptions(std::ios_base::eofbit);
try
- {
+ {
do
stream.getline(currentLine,MAX_SIZE_OF_LINE_XFIG_FILE);
while(strcmp(currentLine,"1200 2")!=0);
pushBack(newEdge);
}
while(1);
- }
+ }
catch(std::ifstream::failure&)
- {
- }
+ {
+ }
front()->changeStartNodeWith(back()->getEndNode());
}
* the cell id in global other mesh.
*/
void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
- const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther,
- int offset1, int offset2 ,
- const std::vector<int>& otherEdgeIds,
- std::vector<int>& edgesThis, int cellIdThis,
- std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther,
- std::vector<double>& addCoo)
+ const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther,
+ int offset1, int offset2 ,
+ const std::vector<int>& otherEdgeIds,
+ std::vector<int>& edgesThis, int cellIdThis,
+ std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther,
+ std::vector<double>& addCoo)
{
double xBaryBB, yBaryBB;
double fact=normalizeExt(&other, xBaryBB, yBaryBB);
* Method to find edges that are ON.
*/
void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
- const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1,
- const std::vector<std::vector<int> >& intersectEdges1, const std::vector< std::vector<int> >& colinear1) const
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1,
+ const std::vector<std::vector<int> >& intersectEdges1, const std::vector< std::vector<int> >& colinear1) const
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
for(std::list<ElementaryEdge *>::const_iterator it=cpyOfOther._sub_edges.begin();it!=cpyOfOther._sub_edges.end();it++)
{
switch((*it)->getLoc())
- {
+ {
case FULL_IN_1:
{
ret += fabs((*it)->getPtr()->getCurveLength());
default:
{
}
- }
+ }
}
return ret * fact;
}
{
barycenter[0]=barycenter[0]/ret*fact+xBaryBB;
barycenter[1]=barycenter[1]/ret*fact+yBaryBB;
-
+
}
return ret*fact*fact;
}
it1=curE2->getIterator();
for(;!it1.finished();)
{
-
+
ElementaryEdge* curE1=it1.current();
merge.clear(); nbOfSplits++;
if(curE1->getPtr()->intersectWith(curE2->getPtr(),merge,*c1,*c2))
if(!f)
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice::New : empty field !");
switch(f->getTimeDiscretization())
- {
+ {
case ONE_TIME:
{
if(arrId.size()!=1)
throw INTERP_KERNEL::Exception("Invalide time discretization ! NO_TIME ! Impossible to build a definition time slice !");
default:
throw INTERP_KERNEL::Exception("Invalide time discretization : Not recognized !");
- }
+ }
}
MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(TypeOfTimeDiscretization type, const std::vector<int>& tiI, const std::vector<double>& tiD)
{
switch(type)
- {
+ {
case ONE_TIME:
return MEDCouplingDefinitionTimeSliceInst::New(tiI,tiD);
case CONST_ON_TIME_INTERVAL:
return MEDCouplingDefinitionTimeSliceLT::New(tiI,tiD);
default:
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice::New : unrecognized time discretization type !");
- }
+ }
}
bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const
double _start;
double _end;
};
-
+
class MEDCouplingDefinitionTimeSliceLT : public MEDCouplingDefinitionTimeSlice
{
public:
* \throw If size of any vector do not match the \a type.
*/
void MEDCouplingField::setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnType method !");
* \throw If the range [_begin_,_end_) is empty.
*/
void MEDCouplingField::setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnCells method !");
}
MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy):RefCountObject(other),_name(other._name),_desc(other._desc),_nature(other._nature),
- _mesh(0),_type(0)
+ _mesh(0),_type(0)
{
if(other._mesh)
{
MEDCOUPLING_EXPORT int getNumberOfMeshPlacesExpected() const;
// Gauss point specific methods
MEDCOUPLING_EXPORT void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void clearGaussLocalizations();
MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId);
MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::New(TypeOfField type)
{
switch(type)
- {
+ {
case MEDCouplingFieldDiscretizationP0::TYPE:
return new MEDCouplingFieldDiscretizationP0;
case MEDCouplingFieldDiscretizationP1::TYPE:
return new MEDCouplingFieldDiscretizationKriging;
default:
throw INTERP_KERNEL::Exception("Choosen discretization is not implemented yet.");
- }
+ }
}
TypeOfField MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(const std::string& repr)
}
void MEDCouplingFieldDiscretization::setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
if(newNb>=0)//if newNb<0 the node is considered as out.
{
if(std::find_if(ptToFill+newNb*nbOfComp,ptToFill+(newNb+1)*nbOfComp,std::bind2nd(std::not_equal_to<double>(),std::numeric_limits<double>::max()))
- ==ptToFill+(newNb+1)*nbOfComp)
+ ==ptToFill+(newNb+1)*nbOfComp)
std::copy(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp);
else
{
}
void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
+ const int *old2NewBg, bool check)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::renumberArraysForCell : NULL input mesh !");
}
void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds : NULL input mesh !");
* Nothing to do here.
*/
void MEDCouplingFieldDiscretizationOnNodes::renumberArraysForCell(const MEDCouplingMesh *, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
+ const int *old2NewBg, bool check)
{
}
}
void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !");
/*!
* This method returns a submesh of 'mesh' instance constituting cell ids contained in array defined as an interval [start;end).
-* @param di is an array returned that specifies entity ids (here nodes ids) in mesh 'mesh' of entity in returned submesh.
+ * @param di is an array returned that specifies entity ids (here nodes ids) in mesh 'mesh' of entity in returned submesh.
* Example : The first node id of returned mesh has the (*di)[0] id in 'mesh'
*/
MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
}
void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
+ const int *old2NewBg, bool check)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::renumberArraysForCell : NULL input mesh !");
INTERP_KERNEL::NormalizedCellType typ=cli.getType();
const std::vector<double>& wg=cli.getWeights();
calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(),
- &cli.getGaussCoords()[0],(int)wg.size(),&cli.getRefCoords()[0],
- INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes());
+ &cli.getGaussCoords()[0],(int)wg.size(),&cli.getRefCoords()[0],
+ INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes());
//
int nbt=parts2[i]->getNumberOfTuples();
for(const int *w=parts2[i]->getConstPointer();w!=parts2[i]->getConstPointer()+nbt;w++)
}
void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds : NULL input mesh !");
}
void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : NULL input mesh !");
}
void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells : NULL input mesh !");
}
void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
+ const int *old2NewBg, bool check)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell : NULL input mesh !");
const double *MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth)
{
switch(geoType)
- {
+ {
case INTERP_KERNEL::NORM_POINT1:
lgth=(int)sizeof(FGP_POINT1)/sizeof(double);
return FGP_POINT1;
return FGP_PYRA13;
default:
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,9], TETRA[4,10], PENTA[6,15], HEXA[8,20,27], PYRA[5,13] supported !");
- }
+ }
}
const double *MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth)
{
switch(geoType)
- {
+ {
case INTERP_KERNEL::NORM_POINT1:
lgth=0;
return 0;
return REF_PYRA13;
default:
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,8,9], TETRA[4,10], PENTA[6,15], HEXA[8,20,27], PYRA[5,13] supported !");
- }
+ }
}
const double *MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth)
{
switch(geoType)
- {
+ {
case INTERP_KERNEL::NORM_POINT1:
{
lgth=0;
}
default:
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,8,9], TETRA[4,10], PENTA[6,15], HEXA[8,20,27], PYRA[5,13] supported !");
- }
+ }
}
void MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds : NULL input mesh !");
void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimension, int nbOfElems, double *matrixPtr) const
{
switch(spaceDimension)
- {
+ {
case 1:
{
for(int i=0;i<nbOfElems;i++)
}
default:
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix : only dimension 1, 2 and 3 implemented !");
- }
+ }
}
/*!
MEDCOUPLING_EXPORT virtual void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const;
MEDCOUPLING_EXPORT virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const = 0;
MEDCOUPLING_EXPORT virtual void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception) = 0;
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const = 0;
MEDCOUPLING_EXPORT virtual void checkCompatibilityWithNature(NatureOfField nat) const = 0;
MEDCOUPLING_EXPORT virtual void renumberCells(const int *old2NewBg, bool check=true);
MEDCOUPLING_EXPORT virtual void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception) = 0;
+ const int *old2NewBg, bool check) = 0;
MEDCOUPLING_EXPORT virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const = 0;
MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0;
MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<double>& tinyInfo);
MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr);
MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT virtual void clearGaussLocalizations();
MEDCOUPLING_EXPORT virtual MEDCouplingGaussLocalization& getGaussLocalization(int locId);
MEDCOUPLING_EXPORT virtual int getNbOfGaussLocalization() const;
MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
+ const int *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
+ const int *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
+ const int *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const;
MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void clearGaussLocalizations();
MEDCOUPLING_EXPORT void setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc);
MEDCOUPLING_EXPORT void resizeLocalizationVector(int newSz);
MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
+ const int *old2NewBg, bool check);
MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
- DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const;
MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
{
_time_discr->copyTinyAttrFrom(*other->_time_discr);
}
-
}
void MEDCouplingFieldDouble::copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other)
*/
void MEDCouplingFieldDouble::renumberCellsWithoutMesh(const int *old2NewBg, bool check)
{
- if(!_mesh)
- throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !");
- if(!((const MEDCouplingFieldDiscretization *)_type))
- throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
//
_type->renumberCells(old2NewBg,check);
std::vector<DataArrayDouble *> arrays;
}
MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingField(type),
- _time_discr(MEDCouplingTimeDiscretization::New(td))
+ _time_discr(MEDCouplingTimeDiscretization::New(td))
{
}
* ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! **
*/
MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingField(ft,false),
- _time_discr(MEDCouplingTimeDiscretization::New(td))
+ _time_discr(MEDCouplingTimeDiscretization::New(td))
{
}
MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingField(other,deepCopy),
- _time_discr(other._time_discr->performCpy(deepCopy))
+ _time_discr(other._time_discr->performCpy(deepCopy))
{
}
* All tuples will have the same value 'value'.
* An exception is thrown if no underlying mesh is defined.
*/
-MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !");
* \throw If the fields are not strictly compatible (areStrictlyCompatible()), i.e. they
* differ not only in values.
*/
-const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
+const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator+=(const MEDCouplingFieldDouble& other)
{
if(!areStrictlyCompatible(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply += on them !");
* \throw If the fields are not strictly compatible (areStrictlyCompatible()), i.e. they
* differ not only in values.
*/
-const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
+const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator-=(const MEDCouplingFieldDouble& other)
{
if(!areStrictlyCompatible(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply -= on them !");
* (areCompatibleForMul()),
* i.e. they differ not only in values and possibly in number of components.
*/
-const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
+const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator*=(const MEDCouplingFieldDouble& other)
{
if(!areCompatibleForMul(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply *= on them !");
* \throw If the fields are not compatible for division (areCompatibleForDiv()),
* i.e. they differ not only in values and possibly in number of components.
*/
-const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
+const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator/=(const MEDCouplingFieldDouble& other)
{
if(!areCompatibleForDiv(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply /= on them !");
*
* \sa MEDCouplingFieldDouble::PowFields
*/
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::operator^(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDCouplingFieldDouble::operator^(const MEDCouplingFieldDouble& other) const
{
return PowFields(this,&other);
}
-const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
+const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCouplingFieldDouble& other)
{
if(!areCompatibleForDiv(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply /= on them !");
stream << "MEDCouplingFieldDouble C++ instance at " << this << ". Name : \"" << _name << "\"." << std::endl;
const char *nat=0;
try
- {
+ {
nat=MEDCouplingNatureOfField::GetRepr(_nature);
stream << "Nature of field : " << nat << ".\n";
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- { }
+ { }
const MEDCouplingFieldDiscretization *fd(_type);
if(!fd)
stream << "No spatial discretization set !";
MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double time, double *res) const;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const;
MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId);
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value);
MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func);
MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, const std::string& func);
MEDCOUPLING_EXPORT void fillFromAnalytic2(int nbOfComp, const std::string& func);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const { return MinFields(this,&other); }
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *negate() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return AddFields(this,&other); }
- MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return SubstractFields(this,&other); }
- MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator-=(const MEDCouplingFieldDouble& other);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MultiplyFields(this,&other); }
- MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator*=(const MEDCouplingFieldDouble& other);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return DivideFields(this,&other); }
- MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator^(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator^=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator^(const MEDCouplingFieldDouble& other) const;
+ MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator^=(const MEDCouplingFieldDouble& other);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *PowFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCOUPLING_EXPORT static void WriteVTK(const std::string& fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary=true);
public:
std::vector<MEDCouplingMesh *> ms;
std::vector<int> refms;
try
- {
+ {
ms=getDifferentMeshes(refms);
ret << ms.size() << "\n";
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- { ret << "Current instance is INVALID !\n"; }
+ { ret << "Current instance is INVALID !\n"; }
try
- {
+ {
MEDCouplingDefinitionTime dt=getDefinitionTimeZone();
dt.appendRepr(ret);
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- { ret << "Definition zone is INVALID !\n"; }
+ { ret << "Definition zone is INVALID !\n"; }
return ret.str();
}
stream << "MEDCouplingFieldTemplate C++ instance at " << this << ". Name : \"" << _name << "\"." << std::endl;
const char *nat=0;
try
- {
+ {
nat=MEDCouplingNatureOfField::GetRepr(_nature);
stream << "Nature of field template : " << nat << ".\n";
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- { }
+ { }
const MEDCouplingFieldDiscretization *fd(_type);
if(!fd)
stream << "No spatial discretization set !";
#include <algorithm>
ParaMEDMEM::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception)
+ const std::vector<double>& gsCoo, const std::vector<double>& w)
try:_type(type),_ref_coord(refCoo),_gauss_coord(gsCoo),_weight(w)
- {
- checkCoherency();
- }
+{
+ checkCoherency();
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
_type=INTERP_KERNEL::NORM_ERROR;
_ref_coord.clear();
_gauss_coord.clear();
_weight.clear();
throw e;
- }
+}
ParaMEDMEM::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ)
try:_type(typ)
INTERP_KERNEL::CellModel::GetCellModel(_type);
}
catch(INTERP_KERNEL::Exception& e)
- {
+{
_type=INTERP_KERNEL::NORM_ERROR;
throw e;
- }
+}
void ParaMEDMEM::MEDCouplingGaussLocalization::setType(INTERP_KERNEL::NormalizedCellType typ)
{
}
if(_gauss_coord.size()!=dim*_weight.size())
{
- std::ostringstream oss; oss << "Invalid gsCoo size and weight size : gsCoo.size() must be equal to _weight.size() * " << dim << " (dim) !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ std::ostringstream oss; oss << "Invalid gsCoo size and weight size : gsCoo.size() must be equal to _weight.size() * " << dim << " (dim) !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
{
public:
MEDCOUPLING_EXPORT MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& gsCoo, const std::vector<double>& w);
MEDCOUPLING_EXPORT MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const { return _type; }
MEDCOUPLING_EXPORT void setType(INTERP_KERNEL::NormalizedCellType typ);
void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const
{
- if(getNumberOfTuples()!=other.getNumberOfTuples())
+ if(getNumberOfTuples()!=other.getNumberOfTuples())
{
std::ostringstream oss; oss << msg << " : mismatch number of tuples : expected " << other.getNumberOfTuples() << " having " << getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
int nbOfCompo=getNumberOfComponents();
if ((nbOfCompo<1) || (nbOfCompo>4)) //test before work
throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : Unexpected spacedim of coords. Must be 1, 2, 3 or 4.");
-
+
int nbOfTuples=getNumberOfTuples();
//
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0);
switch(nbOfCompo)
- {
+ {
case 4:
findCommonTuplesAlg<4>(begin(),nbOfTuples,limitTupleId,prec,c,cI);
break;
break;
default:
throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : nb of components managed are 1,2,3 and 4 ! not implemented for other number of components !");
- }
+ }
comm=c.retn();
commIndex=cI.retn();
}
double bounds[6];
getMinMaxPerComponent(bounds);
switch(nbOfCompo)
- {
+ {
case 3:
{
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4]));
}
default:
throw INTERP_KERNEL::Exception("Unexpected spacedim of coords for findClosestTupleId. Must be 1, 2 or 3.");
- }
+ }
return ret.retn();
}
const double *thisBBPtr(begin());
int *retPtr(ret->getPointer());
switch(nbOfComp/2)
- {
+ {
case 3:
{
BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
}
default:
throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : space dimension supported are [1,2,3] !");
- }
-
+ }
+
return ret.retn();
}
int nbOfTuplesOther=other->getNumberOfTuples();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
switch(nbOfCompo)
- {
+ {
case 3:
{
BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
}
default:
throw INTERP_KERNEL::Exception("Unexpected spacedim of coords for computeTupleIdsNearTuples. Must be 1, 2 or 3.");
- }
+ }
c=cArr.retn(); cI=cIArr.retn();
}
const double *src=getConstPointer();
double *dest=ret->getPointer();
switch(getNumberOfComponents())
- {
+ {
case 6:
for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
default:
ret->decrRef();
throw INTERP_KERNEL::Exception("DataArrayDouble::determinant : Invalid number of components ! must be in 4,6,9 !");
- }
+ }
}
/*!
ret->alloc(nbOfTuple,nbOfComp);
const double *src=getConstPointer();
double *dest=ret->getPointer();
-if(nbOfComp==6)
+ if(nbOfComp==6)
for(int i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
double det=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
for(int i=0;i<nbOfTuples;i++)
{
try
- {
+ {
expr.evaluateExpr(nbOfComp,ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp);
- }
+ }
catch(INTERP_KERNEL::Exception& e)
- {
+ {
std::ostringstream oss; oss << "For tuple # " << i << " with value (";
std::copy(ptr+oldNbOfComp*i,ptr+oldNbOfComp*(i+1),std::ostream_iterator<double>(oss,", "));
oss << ") : Evaluation of function failed !" << e.what();
newArr->decrRef();
throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ }
}
return newArr;
}
for(int i=0;i<nbOfTuples;i++)
{
try
- {
+ {
expr.evaluateExpr(nbOfComp,ptr+i*nbOfComp,ptrToFill+i*nbOfComp);
- }
+ }
catch(INTERP_KERNEL::Exception& e)
- {
+ {
std::ostringstream oss; oss << "For tuple # " << i << " with value (";
std::copy(ptr+nbOfComp*i,ptr+nbOfComp*(i+1),std::ostream_iterator<double>(oss,", "));
oss << ") : Evaluation of function failed ! " << e.what();
newArr->decrRef();
throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ }
}
return newArr;
}
for(int i=0;i<nbOfTuples;i++)
{
try
- {
+ {
expr.evaluateExpr(nbOfComp,ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp);
- }
+ }
catch(INTERP_KERNEL::Exception& e)
- {
+ {
std::ostringstream oss; oss << "For tuple # " << i << " with value (";
std::copy(ptr+oldNbOfComp*i,ptr+oldNbOfComp*(i+1),std::ostream_iterator<double>(oss,", "));
oss << ") : Evaluation of function failed !" << e.what();
newArr->decrRef();
throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ }
}
return newArr;
}
for(int i=0;i<nbOfTuples;i++)
{
try
- {
+ {
expr.evaluateExpr(nbOfComp,ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp);
- }
+ }
catch(INTERP_KERNEL::Exception& e)
- {
+ {
std::ostringstream oss; oss << "For tuple # " << i << " with value (";
std::copy(ptr+oldNbOfComp*i,ptr+oldNbOfComp*(i+1),std::ostream_iterator<double>(oss,", "));
oss << ") : Evaluation of function failed !" << e.what();
newArr->decrRef();
throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ }
}
return newArr;
}
* \throw If any value of \a this is not less than \a arrEnd[-1].
*/
void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd,
- DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception)
-{
+ DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const
+ {
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !");
castArr=ret1.retn();
rankInsideCast=ret2.retn();
castsPresent=ret3.retn();
-}
+ }
/*!
* Creates a one-dimensional DataArrayInt (\a res) whose contents are computed from
{
int v(new2Old[i]);
if(v>=0 && v<oldNbOfElem)
- pt[v]=i;
+ pt[v]=i;
else
{
std::ostringstream oss; oss << "DataArrayInt::invertArrayN2O2O2N : in new id #" << i << " old value is " << v << " expected to be in [0," << oldNbOfElem << ") !";
*/
DataArrayInt *DataArrayInt::buildComplement(int nbOfElement) const
{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !");
- std::vector<bool> tmp(nbOfElement);
- const int *pt=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- for(const int *w=pt;w!=pt+nbOfTuples;w++)
- if(*w>=0 && *w<nbOfElement)
- tmp[*w]=true;
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !");
- int nbOfRetVal=(int)std::count(tmp.begin(),tmp.end(),false);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(nbOfRetVal,1);
- int j=0;
- int *retPtr=ret->getPointer();
- for(int i=0;i<nbOfElement;i++)
- if(!tmp[i])
- retPtr[j++]=i;
- return ret;
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !");
+ std::vector<bool> tmp(nbOfElement);
+ const int *pt=getConstPointer();
+ int nbOfTuples=getNumberOfTuples();
+ for(const int *w=pt;w!=pt+nbOfTuples;w++)
+ if(*w>=0 && *w<nbOfElement)
+ tmp[*w]=true;
+ else
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !");
+ int nbOfRetVal=(int)std::count(tmp.begin(),tmp.end(),false);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfRetVal,1);
+ int j=0;
+ int *retPtr=ret->getPointer();
+ for(int i=0;i<nbOfElement;i++)
+ if(!tmp[i])
+ retPtr[j++]=i;
+ return ret;
}
/*!
checkAllocated();
other->checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !");
if(other->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
const int *pt=getConstPointer();
int nbOfTuples=getNumberOfTuples();
std::set<int> s1(pt,pt+nbOfTuples);
{
checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
int nbOfTuples=getNumberOfTuples();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=deepCpy();
int *data=tmp->getPointer();
{
checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
int nbOfTuples=getNumberOfTuples();
if(nbOfTuples<2)
throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !");
{
checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
int nbOfTuples=getNumberOfTuples();
if(nbOfTuples==0)
return ;
throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !");
checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
offsets->checkAllocated();
if(offsets->getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
int othNbTuples=offsets->getNumberOfTuples()-1;
int nbOfTuples=getNumberOfTuples();
int retNbOftuples=0;
*/
DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt *a2)
{
- if(!a1 || !a2)
+ if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !");
int nbOfTuple1=a1->getNumberOfTuples();
int nbOfTuple2=a2->getNumberOfTuples();
MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd);
MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const;
MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
- DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const;
MEDCOUPLING_EXPORT DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
MEDCOUPLING_EXPORT DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
MEDCOUPLING_EXPORT DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const;
protected:
MemArray<char> _mem;
};
-
+
class DataArrayByteIterator;
class DataArrayByte : public DataArrayChar
char *_pt;
int _nb_of_compo;
};
-
+
class DataArrayAsciiCharIterator;
-
+
class DataArrayAsciiChar : public DataArrayChar
{
public:
else
throw INTERP_KERNEL::Exception("DataArrayDouble::insertAtTheEnd : not available for DataArrayDouble with number of components different than 1 !");
}
-
+
template<class InputIterator>
void DataArrayInt::insertAtTheEnd(InputIterator first, InputIterator last)
{
_ownership=false;
_dealloc=CPPDeallocator;
}
-
+
template<class T>
void MemArray<T>::writeOnPlace(std::size_t id, T element0, const T *others, std::size_t sizeOfOthers)
{
std::copy(others,others+sizeOfOthers,pointer+id+1);
_nb_of_elem=std::max<std::size_t>(_nb_of_elem,id+sizeOfOthers+1);
}
-
+
template<class T>
template<class InputIterator>
void MemArray<T>::insertAtTheEnd(InputIterator first, InputIterator last)
pointer[_nb_of_elem++]=*first++;
}
}
-
+
template<class T>
void MemArray<T>::pushBack(T elem)
{
T *pt=getPointer();
pt[_nb_of_elem++]=elem;
}
-
+
template<class T>
T MemArray<T>::popBack()
{
}
throw INTERP_KERNEL::Exception("MemArray::popBack : nothing to pop in array !");
}
-
+
template<class T>
void MemArray<T>::pack() const
{
{
if(sl!=0)
stream << _nb_of_elem/sl << std::endl << "Internal memory facts : " << _nb_of_elem << "/" << _nb_of_elem_alloc;
- else
+ else
stream << "Empty Data";
}
else
stream << "No data !\n";
return ret;
}
-
+
/*!
* \param [in] sl is typically the number of components
*/
stream << "Empty Data\n";
}
}
-
+
/*!
* \param [in] sl is typically the number of components
*/
else
stream << "No data !\n";
}
-
+
template<class T>
void MemArray<T>::fillWithValue(const T& val)
{
T *pt=_pointer.getPointer();
std::fill(pt,pt+_nb_of_elem,val);
}
-
+
template<class T>
T *MemArray<T>::fromNoInterlace(int nbOfComp) const
{
*w=pt[j*nbOfTuples+i];
return ret;
}
-
+
template<class T>
T *MemArray<T>::toNoInterlace(int nbOfComp) const
{
typename MemArray<T>::Deallocator MemArray<T>::BuildFromType(DeallocType type)
{
switch(type)
- {
+ {
case CPP_DEALLOC:
return CPPDeallocator;
case C_DEALLOC:
return CDeallocator;
default:
throw INTERP_KERNEL::Exception("Invalid deallocation requested ! Unrecognized enum DeallocType !");
- }
+ }
}
template<class T>
_nb_of_elem=0;
_nb_of_elem_alloc=0;
}
-
+
template<class T>
MemArray<T> &MemArray<T>::operator=(const MemArray<T>& other)
{
std::vector<MEDCouplingMesh *> ms;
std::vector<int> refms;
try
- {
+ {
ms=getDifferentMeshes(refms);
ret << ms.size() << "\n";
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- { ret << "Current instance is INVALID !\n"; }
+ { ret << "Current instance is INVALID !\n"; }
return ret.str();
}
namespace ParaMEDMEM
{
const char *MEDCouplingNatureOfField::REPR_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]=
- { "NoNature",
- "ConservativeVolumic",
- "Integral",
- "IntegralGlobConstraint",
- "RevIntegral"};
-
+ { "NoNature",
+ "ConservativeVolumic",
+ "Integral",
+ "IntegralGlobConstraint",
+ "RevIntegral"};
+
const int MEDCouplingNatureOfField::POS_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]={17,26,32,35,37};
const char *MEDCouplingNatureOfField::GetRepr(NatureOfField nat)
namespace ParaMEDMEM
{
typedef enum
- {
- NoNature = 17,
- ConservativeVolumic = 26,
- Integral = 32,
- IntegralGlobConstraint = 35,
- RevIntegral = 37
- } NatureOfField;
+ {
+ NoNature = 17,
+ ConservativeVolumic = 26,
+ Integral = 32,
+ IntegralGlobConstraint = 35,
+ RevIntegral = 37
+ } NatureOfField;
}
#endif
namespace ParaMEDMEM
{
typedef enum
- {
- C_DEALLOC = 2,
- CPP_DEALLOC = 3
- } DeallocType;
+ {
+ C_DEALLOC = 2,
+ CPP_DEALLOC = 3
+ } DeallocType;
typedef enum
- {
- ON_CELLS = 0,
- ON_NODES = 1,
- ON_GAUSS_PT = 2,
- ON_GAUSS_NE = 3,
- ON_NODES_KR = 4
- } TypeOfField;
+ {
+ ON_CELLS = 0,
+ ON_NODES = 1,
+ ON_GAUSS_PT = 2,
+ ON_GAUSS_NE = 3,
+ ON_NODES_KR = 4
+ } TypeOfField;
typedef enum
- {
- NO_TIME = 4,
- ONE_TIME = 5,
- LINEAR_TIME = 6,
- CONST_ON_TIME_INTERVAL = 7
- } TypeOfTimeDiscretization;
+ {
+ NO_TIME = 4,
+ ONE_TIME = 5,
+ LINEAR_TIME = 6,
+ CONST_ON_TIME_INTERVAL = 7
+ } TypeOfTimeDiscretization;
typedef bool (*FunctionToEvaluate)(const double *pos, double *res);
private:
static std::size_t GetHeapMemoryOfSet(std::set<const BigMemoryObject *>& s1, std::set<const BigMemoryObject *>& s2);
};
-
+
class RefCountObjectOnly
{
protected:
{
int meshInterpType=((int)_src_ft->getMesh()->getType()*16)+(int)_target_ft->getMesh()->getType();
switch(meshInterpType)
- {
+ {
case 90:
case 91:
case 165:
return prepareInterpKernelOnlyEE();
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnly : Not managed type of meshes ! Dealt meshes type are : Unstructured<->Unstructured, Unstructured<->Cartesian, Cartesian<->Cartesian, Extruded<->Extruded !");
- }
+ }
}
int MEDCouplingRemapper::prepareNotInterpKernelOnly()
std::string srcm,trgm,method;
method=checkAndGiveInterpolationMethodStr(srcm,trgm);
switch(CheckInterpolationMethodManageableByNotOnlyInterpKernel(method))
- {
+ {
case 0:
return prepareNotInterpKernelOnlyGaussGauss();
default:
std::ostringstream oss; oss << "MEDCouplingRemapper::prepareNotInterpKernelOnly : INTERNAL ERROR ! the method \"" << method << "\" declared as managed bu not implemented !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
}
/*!
void MEDCouplingRemapper::setInterpolationMatrixPolicy(int newInterpMatPol)
{
switch(newInterpMatPol)
- {
+ {
case 0:
_interp_matrix_pol=IK_ONLY_PREFERED;
break;
break;
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::setInterpolationMatrixPolicy : invalid input integer value ! Should be in [0 (IK_PREFERED) , 1 (NOT_IK_PREFERED), 2 (IK_ONLY_FORCED), 3 (NOT_IK_ONLY_FORCED)] ! For information, the default is IK_PREFERED=0 !");
- }
+ }
}
int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC : space dim of src unstructured should be equal to mesh dim of src unstructured and should be equal also equal to trg cartesian dimension !");
std::vector<std::map<int,double> > res;
switch(srcMeshDim)
- {
+ {
case 1:
{
MEDCouplingNormalizedCartesianMesh<1> targetWrapper(target_mesh);
}
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC : only dimension 1 2 or 3 supported !");
- }
+ }
ReverseMatrix(res,target_mesh->getNumberOfCells(),_matrix);
nullifiedTinyCoeffInCrudeMatrixAbs(0.);
//
if(trgMeshDim!=trgSpceDim || trgMeshDim!=srcMeshDim)
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCU : space dim of target unstructured should be equal to mesh dim of target unstructured and should be equal also equal to source cartesian dimension !");
switch(srcMeshDim)
- {
+ {
case 1:
{
MEDCouplingNormalizedCartesianMesh<1> sourceWrapper(src_mesh);
}
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCU : only dimension 1 2 or 3 supported !");
- }
+ }
nullifiedTinyCoeffInCrudeMatrixAbs(0.);
//
_deno_multiply.clear();
if(trgMeshDim!=srcMeshDim)
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCC : dim of target cartesian should be equal to dim of source cartesian dimension !");
switch(srcMeshDim)
- {
+ {
case 1:
{
MEDCouplingNormalizedCartesianMesh<1> sourceWrapper(src_mesh);
}
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCC : only dimension 1 2 or 3 supported !");
- }
+ }
nullifiedTinyCoeffInCrudeMatrixAbs(0.);
//
_deno_multiply.clear();
int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss()
{
if(getIntersectionType()!=INTERP_KERNEL::PointLocator)
- throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !");
+ throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> trgLoc=_target_ft->getLocalizationOfDiscr();
const double *trgLocPtr=trgLoc->begin();
int trgSpaceDim=trgLoc->getNumberOfComponents();
std::string srcm,trgm,method;
method=checkAndGiveInterpolationMethodStr(srcm,trgm);
switch(_interp_matrix_pol)
- {
+ {
case IK_ONLY_PREFERED:
{
try
- {
+ {
std::string tmp1,tmp2;
INTERP_KERNEL::Interpolation<INTERP_KERNEL::Interpolation3D>::CheckAndSplitInterpolationMethod(method,tmp1,tmp2);
return true;
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- {
+ {
return false;
- }
+ }
}
case NOT_IK_ONLY_PREFERED:
{
try
- {
+ {
CheckInterpolationMethodManageableByNotOnlyInterpKernel(method);
return false;
- }
+ }
catch(INTERP_KERNEL::Exception& /*e*/)
- {
+ {
return true;
- }
+ }
}
case IK_ONLY_FORCED:
return true;
return false;
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::isInterpKernelOnlyOrNotOnly : internal error ! The interpolation matrix policy is not managed ! Try to change it using MEDCouplingRemapper::setInterpolationMatrixPolicy !");
- }
+ }
}
void MEDCouplingRemapper::updateTime() const
if(nat==NoNature)
return computeDenoFromScratch(nat,srcField,trgField);
else if(nat!=_nature_of_deno)
- return computeDenoFromScratch(nat,srcField,trgField);
+ return computeDenoFromScratch(nat,srcField,trgField);
else if(nat==_nature_of_deno && _time_deno_update!=getTimeOfThis())
return computeDenoFromScratch(nat,srcField,trgField);
}
_nature_of_deno=nat;
_time_deno_update=getTimeOfThis();
switch(_nature_of_deno)
- {
+ {
case ConservativeVolumic:
{
ComputeRowSumAndColSum(_matrix,_deno_multiply,_deno_reverse_multiply);
}
case NoNature:
throw INTERP_KERNEL::Exception("No nature specified ! Select one !");
- }
+ }
}
void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer)
namespace ParaMEDMEM
{
typedef enum
- {
- IK_ONLY_PREFERED = 0,
- NOT_IK_ONLY_PREFERED = 1,
- IK_ONLY_FORCED = 2,
- NOT_IK_ONLY_FORCED =3
- } InterpolationMatrixPolicy;
+ {
+ IK_ONLY_PREFERED = 0,
+ NOT_IK_ONLY_PREFERED = 1,
+ IK_ONLY_FORCED = 2,
+ NOT_IK_ONLY_FORCED =3
+ } InterpolationMatrixPolicy;
class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions
{
MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type)
{
switch(type)
- {
+ {
case MEDCouplingNoTimeLabel::DISCRETIZATION:
return new MEDCouplingNoTimeLabel;
case MEDCouplingWithTimeStep::DISCRETIZATION:
return new MEDCouplingLinearTime;
default:
throw INTERP_KERNEL::Exception("Time discretization not implemented yet");
- }
+ }
}
void MEDCouplingTimeDiscretization::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
}
MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
- _time(other._time),_iteration(other._iteration),_order(other._order)
+ _time(other._time),_iteration(other._iteration),_order(other._order)
{
}
}
MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
- MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
- _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
+ MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
+ _end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
{
}
throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::substractaddEqual : Data Array is NULL !");
getArray()->addEqual(other->getArray());
}
-
+
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
{
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
}
MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
- _start_time(other._start_time),_end_time(other._end_time),
- _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
- _start_order(other._start_order),_end_order(other._end_order)
+ _start_time(other._start_time),_end_time(other._end_time),
+ _start_iteration(other._start_iteration),_end_iteration(other._end_iteration),
+ _start_order(other._start_order),_end_order(other._end_order)
{
if(other._end_array)
_end_array=other._end_array->performCpy(deepCpy);
std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const
{
- if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
+ if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
{
std::vector< const DataArrayDouble *> ret(2);
ret[0]=_array;
if((const MEDFileParameters *)_params)
ret.push_back((const MEDFileParameters *)_params);
return ret;
-
+
}
MEDFileFields *MEDFileData::getFields() const
MEDFileData::MEDFileData(const std::string& fileName)
try
- {
+{
_fields=MEDFileFields::New(fileName);
_meshes=MEDFileMeshes::New(fileName);
_params=MEDFileParameters::New(fileName);
- }
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
void MEDFileData::write(const std::string& fileName, int mode) const
{
MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType,
const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_name(locName),_geo_type(geoType),_ref_coo(refCoo),_gs_coo(gsCoo),
- _w(w)
+ _w(w)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
_dim=cm.getDimension();
return false;
if(!MEDCouplingGaussLocalization::AreAlmostEqual(_w,other._w,eps))
return false;
-
+
return true;
}
_type=field->getTypeOfField();
_start=start;
switch(_type)
- {
+ {
case ON_CELLS:
{
getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,offset,offset+nbOfCells,1);
}
default:
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile : not implemented yet for such discretization type of field !");
- }
+ }
start=_end;
}
}
_start=start;
switch(_type)
- {
+ {
case ON_NODES:
{
- _nval=idsInPfl->getNumberOfTuples();
- getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1);
- _end=_start+_nval;
- break;
+ _nval=idsInPfl->getNumberOfTuples();
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1);
+ _end=_start+_nval;
+ break;
}
case ON_CELLS:
{
}
default:
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile : not implemented yet for such discretization type of field !");
- }
+ }
start=_end;
}
MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField atype, int profileIt)
try:_type(atype),_father(fath),_profile_it(profileIt)
- {
- }
+{
+}
catch(INTERP_KERNEL::Exception& e)
{
- throw e;
+ throw e;
}
MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId)
}
MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits<int>::max()),_end(-std::numeric_limits<int>::max()),
- _nval(-std::numeric_limits<int>::max()),_loc_id(-std::numeric_limits<int>::max())
+ _nval(-std::numeric_limits<int>::max()),_loc_id(-std::numeric_limits<int>::max())
{
}
med_geometry_type mgeoti;
med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
_nval=MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ pflname,&profilesize,locname,&nbi);
_profile=MEDLoaderBase::buildStringFromFortran(pflname,MED_NAME_SIZE);
_localization=MEDLoaderBase::buildStringFromFortran(locname,MED_NAME_SIZE);
_start=start;
int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, int locId)
{
switch(type)
- {
+ {
case ON_CELLS:
return -2;
case ON_GAUSS_NE:
return locId;
default:
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::ConvertType : not managed type of field !");
- }
+ }
}
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries)
int nbEntityElts=subIds->getNumberOfTuples();
bool ret2;
MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
- NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity() || nbEntityElts!=newCode[3*(*idIt)+1],nbi,
- offset+offset2,
- li,glob,ret2);
+ NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity() || nbEntityElts!=newCode[3*(*idIt)+1],nbi,
+ offset+offset2,
+ li,glob,ret2);
ret=ret || ret2;
result.push_back(eltToAdd);
offset2+=nbEntityElts*nbi;
bool isPfl, int nbi, int offset,
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob,
- bool ¬InExisting) throw(INTERP_KERNEL::Exception)
+ bool ¬InExisting)
{
int nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin();
entriesOnSameDisc.erase(it);
return ret;
}
-
+
}
MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc)
med_entity_type MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType)
{
switch(ikType)
- {
+ {
case ON_CELLS:
medfGeoType=typmai3[(int)ikGeoType];
return MED_CELL;
return MED_CELL;
default:
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType : unexpected entity type ! internal error");
- }
+ }
return MED_UNDEF_ENTITY_TYPE;
}
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
+ const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
isPfl=false;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(type,ONE_TIME);
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIdentity())
{
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob,
const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIdentity())
{
}
MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc):_mesh_iteration(meshIteration),_mesh_order(meshOrder),
- _mesh_csit(meshCsit),_father(fath)
+ _mesh_csit(meshCsit),_father(fath)
{
INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
}
bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
- MEDFileFieldGlobsReal& glob)
+ MEDFileFieldGlobsReal& glob)
{
bool ret=false;
for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
bool isPfl=false;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc);
switch(renumPol)
- {
+ {
case 0:
{
//no need to test _field_per_mesh.empty() because geMeshName has already done it
}
default:
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : unsupported renum policy ! Dealing with policy 0 1 2 and 3 !");
- }
+ }
}
/*!
LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
switch(typcha)
- {
+ {
case MED_FLOAT64:
{
ret=MEDFileField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
ret->setDtUnit(dtunit.c_str());
ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
//
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll)
{
int nbSteps=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
switch(typcha)
- {
+ {
case MED_FLOAT64:
{
ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
ret->setDtUnit(dtunit.c_str());
ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
//
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName)
{
int nbOfStep2=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
switch(typcha)
- {
+ {
case MED_FLOAT64:
{
ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector<std::string>());
std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName,iteration,order) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
ret->setDtUnit(dtunit.c_str());
ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
//
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
/*!
* This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
}
std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
- std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception)
+ std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs);
}
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll)
try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
/*!
* This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileField1TS::MEDFileField1TS()
{
}
std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
- std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception)
+ std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
}
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll)
try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
/*!
* This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
}
catch(INTERP_KERNEL::Exception& e)
{
- throw e;
+ throw e;
}
std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
}
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
- MEDFileFieldGlobsReal& glob)
+ MEDFileFieldGlobsReal& glob)
{
bool ret=false;
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
med_float dt=0.0;
MEDfieldComputingStepMeshInfo(fid,_name.c_str(),i+1,&numdt,&numo,&dt,&meshIt,&meshOrder);
switch(fieldTyp)
- {
+ {
case MED_FLOAT64:
{
_time_steps[i]=MEDFileField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos);
}
default:
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32 !");
- }
+ }
if(loadAll)
_time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this);
else
elt->loadBigArraysRecursively(fid,nasc);
}
}
-
+
void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
{
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll)
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll)
{
MEDFileAnyTypeField1TS::LocateField(fid,fileName,fieldName,i,typcha,infos,dtunit);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
switch(typcha)
- {
+ {
case MED_FLOAT64:
{
ret=new MEDFileFieldMultiTSWithoutSDA(fid,i,loadAll);
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
ret->setDtUnit(dtunit.c_str());
return ret.retn();
}
MEDFileAnyTypeField1TS::LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
switch(typcha)
- {
+ {
case MED_FLOAT64:
{
ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll);
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fileName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
ret->setDtUnit(dtunit.c_str());
return ret.retn();
}
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
//= MEDFileIntFieldMultiTSWithoutSDA
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const
{
return ret;
}
- MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull()
+MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull()
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
if(!pt)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileFieldMultiTS::MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll)
try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeFieldMultiTS(other,shallowCopyOfContent)
{
return ret;
}
- MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull()
+MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull()
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
if(!pt)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll)
try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
- { throw e; }
+{ throw e; }
DataArrayInt *MEDFileIntFieldMultiTS::getUndergroundDataArray(int iteration, int order) const
{
MEDFileFields::MEDFileFields(const std::string& fileName, bool loadAll)
try:MEDFileFieldGlobsReal(fileName)
- {
- MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- int nbFields=MEDnField(fid);
- _fields.resize(nbFields);
- med_field_type typcha;
- for(int i=0;i<nbFields;i++)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ int nbFields=MEDnField(fid);
+ _fields.resize(nbFields);
+ med_field_type typcha;
+ for(int i=0;i<nbFields;i++)
+ {
+ std::vector<std::string> infos;
+ std::string fieldName,dtunit;
+ int nbOfStep=MEDFileAnyTypeField1TS::LocateField2(fid,fileName,i,false,fieldName,typcha,infos,dtunit);
+ switch(typcha)
{
- std::vector<std::string> infos;
- std::string fieldName,dtunit;
- int nbOfStep=MEDFileAnyTypeField1TS::LocateField2(fid,fileName,i,false,fieldName,typcha,infos,dtunit);
- switch(typcha)
+ case MED_FLOAT64:
{
- case MED_FLOAT64:
- {
- _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll);
- break;
- }
- case MED_INT32:
- {
- _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll);
- break;
- }
- default:
- {
- std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << fileName << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll);
+ break;
+ }
+ case MED_INT32:
+ {
+ _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll);
+ break;
+ }
+ default:
+ {
+ std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << fileName << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- loadAllGlobals(fid);
- }
+ }
+ loadAllGlobals(fid);
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
void MEDFileFields::writeLL(med_idt fid) const
{
std::vector<double> _w;
};
-/// @cond INTERNAL
+ /// @cond INTERNAL
class MEDFileAnyTypeField1TSWithoutSDA;
class MEDFileFieldPerMeshPerType;
class MEDFileField1TSWithoutSDA;
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >& result);
static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
- MEDFileFieldGlobsReal& glob, bool ¬InExisting) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldGlobsReal& glob, bool ¬InExisting);
private:
MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt);
MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt, const std::string& dummy);
private:
int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+ const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const;
void assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,
std::string _file_name;
};
-/// @endcond INTERNAL
+ /// @endcond INTERNAL
class MEDFileFieldGlobsReal
{
};
class MEDFileIntField1TSWithoutSDA;
-
+
/*!
* SDA is for Shared Data Arrays such as profiles.
*/
MEDLOADER_EXPORT std::vector<std::string>& getInfo();
MEDLOADER_EXPORT std::vector<TypeOfField> getTypesOfFieldAvailable() const;
MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
- std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
+ std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
protected:
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> _content;
};
-
+
class MEDFileIntField1TS;
-
+
/*!
* User class.
*/
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const;
MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const;
MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
-
+
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
- std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
+ std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
public:
MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr);
MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr);
MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll);
MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
};
-
+
class MEDFileAnyTypeFieldMultiTSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
{
protected:
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *nextt();
private:
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> _fmts;
- int _iter_id;
- int _nb_iter;
+ int _iter_id;
+ int _nb_iter;
};
class MEDFileFieldsIterator;
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *nextt();
private:
MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fs;
- int _iter_id;
- int _nb_iter;
+ int _iter_id;
+ int _nb_iter;
};
}
using namespace ParaMEDMEM;
const unsigned char MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE[MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE_LGTH]=
- {1,3,21,5,9,7,22,34,23,28,255,255,255,255,10,14,13,255,12,255,24,255,16,27,255,26,255,29,255,255,25,42,36,4};
+{1,3,21,5,9,7,22,34,23,28,255,255,255,255,10,14,13,255,12,255,24,255,16,27,255,26,255,29,255,255,25,42,36,4};
const unsigned char MEDMeshMultiLev::HEXA27_PERM_ARRAY[27]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,24,22,21,23,20,25,26};
std::size_t sz(_nb_entities.size());
for(std::size_t i=0;i<sz;i++)
if(_geo_types[i]==t)
- return _nb_entities[i];
+ return _nb_entities[i];
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getNumberOfCells : not existing geometric type in this !");
}
if(pflName.empty() && !nr)
return vals->deepCpy();
if(pflName.empty() && nr)
- throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !");
+ throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !");
if(!pflName.empty() && nr)
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCpy());
void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
{
- if(!pflNodes || !pflNodes->isAllocated())
- return ;
- std::size_t sz(_parts.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a(sz);
- std::vector< const DataArrayInt *> aa(sz);
- for(std::size_t i=0;i<sz;i++)
- {
- const DataArrayInt *pfl(_pfls[i]);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m(_parts[i]);
- if(pfl)
- m=dynamic_cast<MEDCoupling1GTUMesh *>(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
- DataArrayInt *cellIds=0;
- m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsSafe(cellIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
- int tmp=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m2->getNodeIdsInUse(tmp));
- a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i];
- if(pfl)
- _pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
- else
- _pfls[i]=cellIdsSafe;
- }
- if(!aa.empty())
- _node_reduction=DataArrayInt::Aggregate(aa);//general case
- else
- _node_reduction=pflNodes->deepCpy();//case where no cells in read mesh.
- _node_reduction->sort(true);
- _node_reduction=_node_reduction->buildUnique();
- if(_node_reduction->getNumberOfTuples()==pflNodes->getNumberOfTuples())
- return ;//This is the classical case where the input node profile corresponds perfectly to a subset of cells in _parts
- if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples())
- throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !");
- // Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts...
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pflNodes2(pflNodes->deepCpy());
- pflNodes2->sort(true);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
- appendVertices(diff,pflNodes2);
+ if(!pflNodes || !pflNodes->isAllocated())
+ return ;
+ std::size_t sz(_parts.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a(sz);
+ std::vector< const DataArrayInt *> aa(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const DataArrayInt *pfl(_pfls[i]);
+ MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m(_parts[i]);
+ if(pfl)
+ m=dynamic_cast<MEDCoupling1GTUMesh *>(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
+ DataArrayInt *cellIds=0;
+ m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsSafe(cellIds);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
+ int tmp=-1;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m2->getNodeIdsInUse(tmp));
+ a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i];
+ if(pfl)
+ _pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
+ else
+ _pfls[i]=cellIdsSafe;
+ }
+ if(!aa.empty())
+ _node_reduction=DataArrayInt::Aggregate(aa);//general case
+ else
+ _node_reduction=pflNodes->deepCpy();//case where no cells in read mesh.
+ _node_reduction->sort(true);
+ _node_reduction=_node_reduction->buildUnique();
+ if(_node_reduction->getNumberOfTuples()==pflNodes->getNumberOfTuples())
+ return ;//This is the classical case where the input node profile corresponds perfectly to a subset of cells in _parts
+ if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples())
+ throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !");
+ // Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts...
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pflNodes2(pflNodes->deepCpy());
+ pflNodes2->sort(true);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
+ appendVertices(diff,pflNodes2);
}
MEDMeshMultiLev *MEDUMeshMultiLev::prepare() const
throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase only one geo types supported at most supported for the moment !");
INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(_mesh->getMeshDimension()));
if(_geo_types[0]==gt)
- return false;
+ return false;
MEDCoupling1GTUMesh *facesIfPresent((static_cast<const MEDFileStructuredMesh *>(_mesh))->getImplicitFaceMesh());
if(!facesIfPresent)
return false;
ret2->setNumberIdsOnCells(tmp,false);
}
return ret2.retn();
-
+
}
else
{
return true;
}
-bool MEDFileField1TSStructItem2::operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception)
+bool MEDFileField1TSStructItem2::operator==(const MEDFileField1TSStructItem2& other) const
{
//_nb_of_entity is not taken into account here. It is not a bug, because no mesh consideration needed here to perform fast compare.
//idem for _loc. It is not an effective attribute for support comparison.
void MEDFileField1TSStructItem::checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs)
{
switch(_type)
- {
+ {
case ON_NODES:
{
int nbOfEnt=mst->getNumberOfNodes();
}
default:
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : not managed field type !");
- }
+ }
}
-bool MEDFileField1TSStructItem::operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception)
+bool MEDFileField1TSStructItem::operator==(const MEDFileField1TSStructItem& other) const
{
if(_type!=other._type)
return false;
return false;
}
-const MEDFileField1TSStructItem2& MEDFileField1TSStructItem::operator[](std::size_t i) const throw(INTERP_KERNEL::Exception)
+const MEDFileField1TSStructItem2& MEDFileField1TSStructItem::operator[](std::size_t i) const
{
if(i>=_items.size())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::operator[] : input is not in valid range !");
int _nb_nodes;
std::vector< std::vector<int> > _geo_types_distrib;
};
-
+
class MEDFileField1TSStructItem;
-
+
class MEDMeshMultiLev : public RefCountObject
{
public:
static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH];
static const unsigned char HEXA27_PERM_ARRAY[27];
};
-
+
class MEDStructuredMeshMultiLev;
-
+
class MEDUMeshMultiLev : public MEDMeshMultiLev
{
public:
protected:
bool _is_internal;
};
-
+
class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
{
public:
//! warning this method also set _nb_of_entity attribute !
void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs);
bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const;
- bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception);
+ bool operator==(const MEDFileField1TSStructItem2& other) const;
bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
static MEDFileField1TSStructItem2 BuildAggregationOf(const std::vector<const MEDFileField1TSStructItem2 *>& objs, const MEDFileFieldGlobsReal *globs);
MEDFileField1TSStructItem() { }
MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b);
void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
- bool operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception);
+ bool operator==(const MEDFileField1TSStructItem& other) const;
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
bool isEntityCell() const;
bool isComputed() const { return _computed; }
TypeOfField getType() const { return _type; }
std::size_t getNumberOfItems() const { return _items.size(); }
- const MEDFileField1TSStructItem2& operator[](std::size_t i) const throw(INTERP_KERNEL::Exception);
+ const MEDFileField1TSStructItem2& operator[](std::size_t i) const;
//
bool isCellSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const;
bool isNodeSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const;
std::string dummy2;
MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
switch(meshType)
- {
+ {
case UNSTRUCTURED:
{
MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret=MEDFileUMesh::New();
std::ostringstream oss; oss << "MEDFileMesh::New : MED file exists and has mesh '" << ms.front() << "' exists but unsupported type yet !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
}
/*!
std::string dummy2;
MEDFileMeshL2::GetMeshIdFromName(fid,mName,meshType,dummy0,dummy1,dummy2);
switch(meshType)
- {
+ {
case UNSTRUCTURED:
{
MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret=MEDFileUMesh::New();
std::ostringstream oss; oss << "MEDFileMesh::New : MED file exists and has mesh '" << mName << "' exists but unsupported type yet !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
}
/*!
*/
void MEDFileMesh::clearNonDiscrAttributes() const
{
-
+
}
bool MEDFileMesh::changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
oss << " Group \"" << (*it).first << "\" on following families :\n";
for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
- oss << " \"" << *it2 << "\n";
+ oss << " \"" << *it2 << "\n";
}
oss << "Second group description :\n";
for(std::map<std::string, std::vector<std::string> >::const_iterator it=other->_groups.begin();it!=other->_groups.end();it++)
std::map<std::string,int>::const_iterator it=_families.find(fname);
if(it==_families.end())
{
- for(std::map<std::string,int>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
- if((*it2).second==famId)
- {
- std::ostringstream oss;
- oss << "MEDFileMesh::addFamily : Family \"" << (*it2).first << "\" already exists with specified id : " << famId << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- _families[fname]=famId;
+ for(std::map<std::string,int>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
+ if((*it2).second==famId)
+ {
+ std::ostringstream oss;
+ oss << "MEDFileMesh::addFamily : Family \"" << (*it2).first << "\" already exists with specified id : " << famId << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ _families[fname]=famId;
}
else
{
MEDFileUMesh::MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
try
- {
+{
loadUMeshFromFile(fid,mName,dt,it,mrs);
- }
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUMeshSplitL1 *MEDFileUMesh::getMeshAtLevSafe(int meshDimRelToMaxExt)
{
- if(meshDimRelToMaxExt==1)
+ if(meshDimRelToMaxExt==1)
throw INTERP_KERNEL::Exception("Dimension request is invalid : asking for node level (1) !");
if(meshDimRelToMaxExt>1)
throw INTERP_KERNEL::Exception("Dimension request is invalid (>1) !");
bool hasChanged=m->unPolyze();
DataArrayInt *fake=0;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
- MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake);
+ MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake);
fake->decrRef();
renumCellsSplited.push_back(o2nCellsPart); memorySaverIfThrow.push_back(o2nCellsPart);
if(hasChanged)
if((const DataArrayInt *)_num_faces)
ret.push_back((const DataArrayInt *)_num_faces);
if((const DataArrayInt *)_rev_num_nodes)
- if((const DataArrayAsciiChar *)_names_faces)
- ret.push_back((const DataArrayAsciiChar *)_names_faces);
ret.push_back((const DataArrayInt *)_rev_num_nodes);
+ if((const DataArrayAsciiChar *)_names_faces)
+ ret.push_back((const DataArrayAsciiChar *)_names_faces);
if((const DataArrayInt *)_rev_num_cells)
ret.push_back((const DataArrayInt *)_rev_num_cells);
return ret;
{
std::vector<int> famIds(getFamiliesIds(fams));
switch(meshDimRelToMaxExt)
- {
+ {
case 1:
{
if((const DataArrayInt *)_fam_nodes)
}
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getFamiliesArr : input meshDimRelative must be in [0,1,-1] !");
- }
+ }
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getFamiliesArr : unmanaged case !");
}
/*!
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setFamilyFieldArr : no structured mesh specified ! Impossible to set family array !");
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
{
int nbCells=mesh->getNumberOfCells();
}
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setFamilyFieldArr : Only available for levels 0 or 1 or -1 !");
- }
+ }
if(famArr)
famArr->incrRef();
}
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setRenumFieldArr : no structured mesh specified ! Impossible to set number array !");
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
{
int nbCells=mesh->getNumberOfCells();
}
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setRenumFieldArr : Only available for levels 0 or 1 or -1 !");
- }
+ }
if(renumArr)
renumArr->incrRef();
}
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setNameFieldAtLevel : no structured mesh specified ! Impossible to set names array !");
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
{
int nbCells=mesh->getNumberOfCells();
}
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setNameFieldAtLevel : Only available for levels 0 or 1 or -1 !");
- }
+ }
if(nameArr)
nameArr->incrRef();
}
const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
return _fam_cells;
case 1:
return _fam_faces;
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getFamilyFieldAtLevel : Only available for levels 0 or 1 or -1 !");
- }
+ }
}
/*!
const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
return _num_cells;
case 1:
return _num_faces;
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getNumberFieldAtLevel : Only available for levels 0 or 1 or -1 !");
- }
+ }
}
/*!
const DataArrayAsciiChar *MEDFileStructuredMesh::getNameFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
return _names_cells;
case 1:
return _names_faces;
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getNameFieldAtLevel : Only available for levels 0 or 1 or -1 !");
- }
+ }
}
/*!
throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh does not support renumbering ! To do it perform request of renum array directly !");
const MEDCouplingStructuredMesh *m(getStructuredMesh());
switch(meshDimRelToMax)
- {
+ {
case 0:
{
if(m)
}
default:
throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh does not support multi level for mesh 0 expected as input !");
- }
+ }
}
/*!
if(!cmesh)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getSizeAtLevel : No structured mesh set !");
switch(meshDimRelToMaxExt)
- {
+ {
case 0:
return cmesh->getNumberOfCells();
case 1:
return cmesh->getNumberOfCellsOfSubLevelMesh();
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getSizeAtLevel : Only available for levels 0 or 1 or -1 !");
- }
+ }
}
int MEDFileStructuredMesh::getNumberOfNodes() const
if(!cmesh)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGeoTypesAtLevel : No structured mesh set !");
switch(meshDimRelToMax)
- {
+ {
case 0:
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret(1,cmesh->getTypeOfCell(0));
}
default:
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGeoTypesAtLevel : only 2 levels available at most : 0 and -1 !");
- }
+ }
}
void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const
MEDFileCMesh::MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
try
- {
+{
loadCMeshFromFile(fid,mName,dt,it,mrs);
- }
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
void MEDFileCMesh::loadCMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
try
- {
+{
loadCLMeshFromFile(fid,mName,dt,it,mrs);
- }
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
void MEDFileCurveLinearMesh::writeLL(med_idt fid) const
{
MEDmeshGridTypeWr(fid,maa,MED_CURVILINEAR_GRID);
std::vector<int> nodeGridSt=_clmesh->getNodeGridStructure();
MEDmeshGridStructWr(fid,maa,_iteration,_order,_time,&nodeGridSt[0]);
-
+
MEDmeshNodeCoordinateWr(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin());
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName)
try
- {
+{
std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
if(ms.empty())
- {
- std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ {
+ std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int dt,it;
std::string dummy2;
MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
loadFromFile(fileName,ms.front());
- }
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
try
- {
+{
loadFromFile(fileName,mName);
- }
+}
catch(INTERP_KERNEL::Exception& e)
- {
+{
throw e;
- }
+}
MEDFileMeshes *MEDFileMeshes::New()
{
MEDFileMeshes::MEDFileMeshes(const std::string& fileName)
try
- {
+{
loadFromFile(fileName);
- }
+}
catch(INTERP_KERNEL::Exception& /*e*/)
- {
- }
+{
+}
MEDFileMeshes *MEDFileMeshes::deepCpy() const
{
{
class MEDFileFieldGlobsReal;
class MEDFileField1TSStructItem;
-
+
class MEDFileMesh : public RefCountObject, public MEDFileWritable
{
public:
MEDLOADER_EXPORT MEDFileMesh *nextt();
private:
MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _ms;
- int _iter_id;
- int _nb_iter;
+ int _iter_id;
+ int _nb_iter;
};
}
{
med_bool changement,transformation;
int tmp=MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,
- &changement,&transformation);
+ &changement,&transformation);
if(tmp>nbOfElt)
{
nbOfElt=tmp;
{
med_bool changement,transformation;
int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,
- &changement,&transformation);
+ &changement,&transformation);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(!cm.isDynamic())
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
switch(type_maillage)
- {
+ {
case MED_UNSTRUCTURED_MESH:
meshType=UNSTRUCTURED;
break;
med_grid_type gt;
MEDmeshGridTypeRd(fid,mname.c_str(),>);
switch(gt)
- {
+ {
case MED_CARTESIAN_GRID:
meshType=CARTESIAN;
break;
break;
default:
throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized structured mesh type ! Supported are :\n - cartesian\n - curve linear\n");
- }
+ }
break;
}
default:
throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized mesh type !");
- }
+ }
med_int numdt,numit;
med_float dtt;
MEDmeshComputationStepInfo(fid,mname.c_str(),1,&numdt,&numit,&dtt);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> univTmp=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
if(MEDmeshInfo(fid,mId,nameTmp,&spaceDim,&Mdim,&type_maillage,_description.getPointer(),_dt_unit.getPointer(),
- &stype,&nstep,&axistype,axisname,axisunit)!=0)
+ &stype,&nstep,&axistype,axisname,axisunit)!=0)
throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !");
MEDmeshUniversalNameRd(fid,nameTmp,_univ_name.getPointer());
switch(type_maillage)
- {
+ {
case MED_UNSTRUCTURED_MESH:
meshType=UNSTRUCTURED;
break;
med_grid_type gt;
MEDmeshGridTypeRd(fid,mName.c_str(),>);
switch(gt)
- {
+ {
case MED_CARTESIAN_GRID:
meshType=CARTESIAN;
break;
break;
default:
throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getAxisInfoOnMesh : unrecognized structured mesh type ! Supported are :\n - cartesian\n - curve linear\n");
- }
+ }
break;
}
default:
throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized mesh type !");
- }
+ }
//
std::vector<std::string> infosOnComp(naxis);
for(int i=0;i<naxis;i++)
med_data_type MEDFileCMeshL2::GetDataTypeCorrespondingToSpaceId(int id)
{
switch(id)
- {
+ {
case 0:
return MED_COORDINATE_AXIS1;
case 1:
return MED_COORDINATE_AXIS3;
default:
throw INTERP_KERNEL::Exception("Invalid meshdim detected in Cartesian Grid !");
- }
+ }
}
MEDFileCLMeshL2::MEDFileCLMeshL2()
* This method ignores _m and _m_by_types.
*/
void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
- std::map<std::string, std::vector<std::string> >& groups) throw(INTERP_KERNEL::Exception)
+ std::map<std::string, std::vector<std::string> >& groups)
{
std::vector< DataArrayInt * > corr;
_m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
return ((const MEDCouplingUMesh *)_m)==0;
//else _mp_time>=_m_time)
return _m_parts.empty();
-
}
int MEDFileUMeshAggregateCompute::getMeshDimension() const
namespace ParaMEDMEM
{
class MEDFileMeshReadSelector;
-
+
class MEDFileMeshL2 : public RefCountObject
{
public:
private:
MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> _cmesh;
};
-
+
class MEDFileCLMeshL2 : public MEDFileStrMeshL2
{
public:
mutable std::size_t _m_time;
mutable MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m;
};
-
+
class MEDFileUMeshSplitL1 : public RefCountObject
{
friend class MEDFileUMeshPermCompute;
const DataArrayInt *getRevNumberField() const;
void eraseFamilyField();
void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
- std::map<std::string, std::vector<std::string> >& groups) throw(INTERP_KERNEL::Exception);
+ std::map<std::string, std::vector<std::string> >& groups);
void write(med_idt fid, const std::string& mName, int mdim) const;
//
void setFamilyArr(DataArrayInt *famArr);
double tim;
MEDparameterComputationStepInfo(fid,_name.c_str(),i+1,&dt,&it,&tim);
switch(typ)
- {
+ {
case MED_FLOAT64:
_param_per_ts[i]=MEDFileParameterDouble1TSWTI::New(dt,it,tim);
_param_per_ts[i]->readValue(fid,_name.c_str());
break;*/
default:
throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::finishLoading : supporting only FLOAT64 !");
- }
+ }
}
}
int _order;
double _time;
};
-
+
class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
{
public:
med_access_mode MEDFileUtilities::TraduceWriteMode(int medloaderwritemode)
{
switch(medloaderwritemode)
- {
+ {
case 2:
return MED_ACC_CREAT;
case 1:
return MED_ACC_RDWR;
default:
throw INTERP_KERNEL::Exception("Invalid write mode specified ! must be 0(write with no question), 1(append) or 2(creation)");
- }
+ }
}
const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft)
static const char medInt32[]="MED_INT32";
static const char medInt64[]="MED_INT64";
switch(ft)
- {
+ {
case MED_FLOAT64:
return medFloat64;
case MED_INT32:
return medInt64;
default:
throw INTERP_KERNEL::Exception("Non supported field type ! Should be FLOAT64, INT32 or INT64 !");
- }
+ }
}
void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const std::string& msg)
std::ostringstream oss;
oss << " File : \"" << fileName << "\"";
switch(status)
- {
+ {
case MEDLoaderBase::DIR_LOCKED:
{
oss << " has been detected as unreadable : impossible to read anything !";
oss << " has been detected as WRITE ONLY : impossible to read anything !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- }
+ }
AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
if(fid<0)
{
{
}
-MEDFileUtilities::AutoFid::operator med_idt() const
-{
- return _fid;
-}
-
MEDFileUtilities::AutoFid::~AutoFid()
{
MEDfileClose(_fid);
{
public:
AutoFid(med_idt fid);
- operator med_idt() const;
+ operator med_idt() const { return _fid; }
~AutoFid();
private:
med_idt _fid;
};
}
-
+
namespace ParaMEDMEM
{
class MEDLOADER_EXPORT MEDFileWritable
#include <algorithm>
med_geometry_type typmai[MED_N_CELL_FIXED_GEO] = { MED_POINT1,
- MED_SEG2,
- MED_SEG3,
- MED_SEG4,
- MED_TRIA3,
- MED_QUAD4,
- MED_TRIA6,
- MED_TRIA7,
- MED_QUAD8,
- MED_QUAD9,
- MED_TETRA4,
- MED_PYRA5,
- MED_PENTA6,
- MED_HEXA8,
- MED_OCTA12,
- MED_TETRA10,
- MED_PYRA13,
- MED_PENTA15,
- MED_HEXA20,
- MED_HEXA27,
- MED_POLYGON,
- MED_POLYGON2,
- MED_POLYHEDRON };
+ MED_SEG2,
+ MED_SEG3,
+ MED_SEG4,
+ MED_TRIA3,
+ MED_QUAD4,
+ MED_TRIA6,
+ MED_TRIA7,
+ MED_QUAD8,
+ MED_QUAD9,
+ MED_TETRA4,
+ MED_PYRA5,
+ MED_PENTA6,
+ MED_HEXA8,
+ MED_OCTA12,
+ MED_TETRA10,
+ MED_PYRA13,
+ MED_PENTA15,
+ MED_HEXA20,
+ MED_HEXA27,
+ MED_POLYGON,
+ MED_POLYGON2,
+ MED_POLYHEDRON };
med_geometry_type typmainoeud[1] = { MED_NONE };
INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO] = { INTERP_KERNEL::NORM_POINT1,
- INTERP_KERNEL::NORM_SEG2,
- INTERP_KERNEL::NORM_SEG3,
- INTERP_KERNEL::NORM_SEG4,
- INTERP_KERNEL::NORM_TRI3,
- INTERP_KERNEL::NORM_QUAD4,
- INTERP_KERNEL::NORM_TRI6,
- INTERP_KERNEL::NORM_TRI7,
- INTERP_KERNEL::NORM_QUAD8,
- INTERP_KERNEL::NORM_QUAD9,
- INTERP_KERNEL::NORM_TETRA4,
- INTERP_KERNEL::NORM_PYRA5,
- INTERP_KERNEL::NORM_PENTA6,
- INTERP_KERNEL::NORM_HEXA8,
- INTERP_KERNEL::NORM_HEXGP12,
- INTERP_KERNEL::NORM_TETRA10,
- INTERP_KERNEL::NORM_PYRA13,
- INTERP_KERNEL::NORM_PENTA15,
- INTERP_KERNEL::NORM_HEXA20,
- INTERP_KERNEL::NORM_HEXA27,
- INTERP_KERNEL::NORM_POLYGON,
- INTERP_KERNEL::NORM_QPOLYG,
- INTERP_KERNEL::NORM_POLYHED };
+ INTERP_KERNEL::NORM_SEG2,
+ INTERP_KERNEL::NORM_SEG3,
+ INTERP_KERNEL::NORM_SEG4,
+ INTERP_KERNEL::NORM_TRI3,
+ INTERP_KERNEL::NORM_QUAD4,
+ INTERP_KERNEL::NORM_TRI6,
+ INTERP_KERNEL::NORM_TRI7,
+ INTERP_KERNEL::NORM_QUAD8,
+ INTERP_KERNEL::NORM_QUAD9,
+ INTERP_KERNEL::NORM_TETRA4,
+ INTERP_KERNEL::NORM_PYRA5,
+ INTERP_KERNEL::NORM_PENTA6,
+ INTERP_KERNEL::NORM_HEXA8,
+ INTERP_KERNEL::NORM_HEXGP12,
+ INTERP_KERNEL::NORM_TETRA10,
+ INTERP_KERNEL::NORM_PYRA13,
+ INTERP_KERNEL::NORM_PENTA15,
+ INTERP_KERNEL::NORM_HEXA20,
+ INTERP_KERNEL::NORM_HEXA27,
+ INTERP_KERNEL::NORM_POLYGON,
+ INTERP_KERNEL::NORM_QPOLYG,
+ INTERP_KERNEL::NORM_POLYHED };
med_geometry_type typmai3[34] = { MED_POINT1,//0
- MED_SEG2,//1
- MED_SEG3,//2
- MED_TRIA3,//3
- MED_QUAD4,//4
- MED_POLYGON,//5
- MED_TRIA6,//6
- MED_TRIA7,//7
- MED_QUAD8,//8
- MED_QUAD9,//9
- MED_SEG4,//10
- MED_NONE,//11
- MED_NONE,//12
- MED_NONE,//13
- MED_TETRA4,//14
- MED_PYRA5,//15
- MED_PENTA6,//16
- MED_NONE,//17
- MED_HEXA8,//18
- MED_NONE,//19
- MED_TETRA10,//20
- MED_NONE,//21
- MED_OCTA12,//22
- MED_PYRA13,//23
- MED_NONE,//24
- MED_PENTA15,//25
- MED_NONE,//26
- MED_HEXA27,//27
- MED_NONE,//28
- MED_NONE,//29
- MED_HEXA20,//30
- MED_POLYHEDRON,//31
- MED_POLYGON2,//32
- MED_NONE//33
+ MED_SEG2,//1
+ MED_SEG3,//2
+ MED_TRIA3,//3
+ MED_QUAD4,//4
+ MED_POLYGON,//5
+ MED_TRIA6,//6
+ MED_TRIA7,//7
+ MED_QUAD8,//8
+ MED_QUAD9,//9
+ MED_SEG4,//10
+ MED_NONE,//11
+ MED_NONE,//12
+ MED_NONE,//13
+ MED_TETRA4,//14
+ MED_PYRA5,//15
+ MED_PENTA6,//16
+ MED_NONE,//17
+ MED_HEXA8,//18
+ MED_NONE,//19
+ MED_TETRA10,//20
+ MED_NONE,//21
+ MED_OCTA12,//22
+ MED_PYRA13,//23
+ MED_NONE,//24
+ MED_PENTA15,//25
+ MED_NONE,//26
+ MED_HEXA27,//27
+ MED_NONE,//28
+ MED_NONE,//29
+ MED_HEXA20,//30
+ MED_POLYHEDRON,//31
+ MED_POLYGON2,//32
+ MED_NONE//33
};
double MEDLoader::_EPS_FOR_NODE_COMP=1.e-12;
int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities);
void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity);
void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
- med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception);
+ med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName);
std::vector<std::string> getMeshNamesFid(med_idt fid);
}
return ret;
}
-med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception)
-{
+med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
+ {
if(meshName.empty())
{
std::vector<std::string> meshes=getMeshNamesFid(fid);
}
trueMeshName=meshName;
return iter-meshes.begin()+1;
-}
+ }
std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
{
std::vector< std::pair<std::string,std::string> > ret(ncomp);
for(int j=0;j<ncomp;j++)
ret[j]=std::pair<std::string,std::string>(MEDLoaderBase::buildStringFromFortran(((char *)comp)+j*MED_SNAME_SIZE,MED_SNAME_SIZE),
- MEDLoaderBase::buildStringFromFortran(((char *)unit)+j*MED_SNAME_SIZE,MED_SNAME_SIZE));
+ MEDLoaderBase::buildStringFromFortran(((char *)unit)+j*MED_SNAME_SIZE,MED_SNAME_SIZE));
return ret;
}
fields[i]=curFieldName;
return ret;
}
-
+
std::vector<std::string> MEDLoader::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
{
MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ pflname,&profilesize,locname,&nbi);
if(nbOfVal>0)
{
ret.push_back(ON_NODES);
{
MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ pflname,&profilesize,locname,&nbi);
if(nbOfVal>0)
{
found=true;
{
CheckFileForRead(fileName);
switch(type)
- {
+ {
case ON_CELLS:
return GetCellFieldNamesOnMesh(fileName,meshName);
case ON_NODES:
return GetNodeFieldNamesOnMesh(fileName,meshName);
default:
throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES or ON_CELLS !");
- }
+ }
}
std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ pflname,&profilesize,locname,&nbi);
if(nbOfVal>0)
{
found=true;
int profilesize,nbi;
MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ pflname,&profilesize,locname,&nbi);
if(curMeshName==meshName && nbOfVal>0)
{
ret.push_back(curFieldName);
{
CheckFileForRead(fileName);
switch(type)
- {
+ {
case ON_CELLS:
return GetCellFieldIterations(fileName,meshName,fieldName);
case ON_NODES:
return GetNodeFieldIterations(fileName,meshName,fieldName);
default:
throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES or ON_CELLS !");
- }
+ }
}
std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
int profilesize,nbi;
MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ pflname,&profilesize,locname,&nbi);
std::string maa_ass_cpp(maa_ass);
if(nbOfVal>0)
{
int profilesize,nbi;
MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
- std::string maa_ass_cpp(maa_ass);
- if(nbOfVal>0)
- {
- if(meshNameCpp==maa_ass_cpp)
- { ret.push_back(std::make_pair(numdt,numo)); }
- else
- s2.insert(maa_ass_cpp);
- }
+ pflname,&profilesize,locname,&nbi);
+ std::string maa_ass_cpp(maa_ass);
+ if(nbOfVal>0)
+ {
+ if(meshNameCpp==maa_ass_cpp)
+ { ret.push_back(std::make_pair(numdt,numo)); }
+ else
+ s2.insert(maa_ass_cpp);
+ }
}
}
else
std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName=\""<< meshName << "\" exists but it is not an unstructured mesh !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
+ return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
}
ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax)
std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
+ return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
}
int MEDLoader::ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName)
std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFamilies : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return mmuPtr->getFamilies(meshDimRelToMax,fams,true);
+ return mmuPtr->getFamilies(meshDimRelToMax,fams,true);
}
ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& grps)
std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromGroups : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return mmuPtr->getGroups(meshDimRelToMax,grps,true);
+ return mmuPtr->getGroups(meshDimRelToMax,grps,true);
}
ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
CheckFileForRead(fileName);
switch(type)
- {
+ {
case ON_CELLS:
return ReadFieldCell(fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
case ON_NODES:
return ReadFieldGaussNE(fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
default:
throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES, ON_CELLS, ON_GAUSS_PT or ON_GAUSS_NE !");
- }
+ }
}
std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+ const std::vector<std::pair<int,int> >& its)
{
if(its.empty())
return std::vector<ParaMEDMEM::MEDCouplingFieldDouble *>();
}
std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+ const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,its);
}
std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+ const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_NODES,fileName,meshName,meshDimRelToMax,fieldName,its);
}
std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+ const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,its);
}
std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+ const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,its);
}
class MEDLOADER_EXPORT MEDLoader
{
- public:
+public:
static void SetEpsilonForNodeComp(double val);
static void SetCompPolicyForCell(int val);
static void SetTooLongStrPolicy(int val);
static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f);
- public:
+public:
static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj);
- private:
+private:
MEDLoader();
- public:
+public:
static double _EPS_FOR_NODE_COMP;
static int _COMP_FOR_CELL;
static int _TOO_LONG_STR;