From: ageay Date: Wed, 18 Apr 2012 06:47:26 +0000 (+0000) Subject: Some doc on nature of field + some little factorization. X-Git-Tag: TRIPOLI_323~56 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba36a8f7f1d167761f16e3118dfb7151edc35696;p=tools%2Fmedcoupling.git Some doc on nature of field + some little factorization. --- diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 0178d4b3f..03e27a72f 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -419,7 +419,7 @@ void MEDCouplingCMesh::getNodeIdsOfCell(int cellId, std::vector& conn) cons }; } -void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception) { int tmp[3]; int spaceDim=getSpaceDimension(); diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index 17a7f7df6..204299178 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -57,7 +57,7 @@ namespace ParaMEDMEM std::set getAllGeoTypes() const; int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; void getNodeIdsOfCell(int cellId, std::vector& conn) const; - void getCoordinatesOfNode(int nodeId, std::vector& coo) const; + void getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const; std::string advancedRepr() const; const DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index aaefc22ff..c88f88662 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -248,7 +248,7 @@ void MEDCouplingExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector& con conn.insert(conn.end(),tmp2.begin(),tmp2.end()); } -void MEDCouplingExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception) { int nbOfNodes2D=_mesh2D->getNumberOfNodes(); int locId=nodeId%nbOfNodes2D; diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index 4203962d1..672dcd9a2 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -55,7 +55,7 @@ namespace ParaMEDMEM std::set getAllGeoTypes() const; int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; void getNodeIdsOfCell(int cellId, std::vector& conn) const; - void getCoordinatesOfNode(int nodeId, std::vector& coo) const; + void getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const; std::string advancedRepr() const; void checkCoherency() const throw (INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index 5516965fe..454afd98c 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -99,6 +99,21 @@ TypeOfField MEDCouplingField::getTypeOfField() const return _type->getEnum(); } +/*! + * This method returns the nature of field. This information is very important during interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC. + * In other context than the two mentioned before this attribute of the field is not sensitive. This attribute is not store in MED file in MEDLoader. + * More information of the semantic, and the behaviour of the interpolation, is explained \ref NatureOfField "here". + */ +NatureOfField MEDCouplingField::getNature() const +{ + return _nature; +} + +/*! + * This method set the nature of field in \b this.This information is very important during interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC. + * In other context than the two mentioned before this attribute of the field is not sensitive. This attribute is not store in MED file in MEDLoader. + * More information of the semantic, and the behaviour of the interpolation, is explained \ref TableNatureOfField "here". + */ void MEDCouplingField::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception) { _nature=nat; diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 772a87ef7..50e1ad397 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -54,7 +54,7 @@ namespace ParaMEDMEM void setDescription(const char *desc) { _desc=desc; } const char *getName() const { return _name.c_str(); } TypeOfField getTypeOfField() const; - NatureOfField getNature() const { return _nature; } + NatureOfField getNature() const; virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception); DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 12b00299b..0311d5967 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -85,7 +85,7 @@ namespace ParaMEDMEM virtual std::set getAllGeoTypes() const = 0; virtual void getNodeIdsOfCell(int cellId, std::vector& conn) const = 0; virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; - virtual void getCoordinatesOfNode(int nodeId, std::vector& coo) const = 0; + virtual void getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception) = 0; virtual std::string simpleRepr() const = 0; virtual std::string advancedRepr() const = 0; // tools diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index dcf19c3e8..f66834967 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -153,6 +153,27 @@ bool MEDCouplingPointSet::areCoordsEqualWithoutConsideringStr(const MEDCouplingP return _coords->isEqualWithoutConsideringStr(*other._coords,prec); } +/*! + * Returns coordinates of node with id 'nodeId' and append it in 'coo'. + */ +void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception) +{ + if(!_coords) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !"); + int nbNodes=getNumberOfNodes(); + if(nodeId>=0 && nodeIdgetConstPointer(); + int spaceDim=getSpaceDimension(); + coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1)); + } + else + { + std::ostringstream oss; oss << "MEDCouplingPointSet::getCoordinatesOfNode : request of nodeId \"" << nodeId << "\" but it should be in [0,"<< nbNodes << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } +} + /*! * This method is typically the base method used for implementation of mergeNodes. This method computes this permutation array using as input, * This method is const ! So this method simply computes the array, no permutation of nodes is done. diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 9f646b5d4..8e0561959 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -66,6 +66,7 @@ namespace ParaMEDMEM bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const; virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes) = 0; virtual DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes) = 0; + void getCoordinatesOfNode(int nodeId, std::vector& coo) const throw(INTERP_KERNEL::Exception); DataArrayInt *buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const; std::vector getNodeIdsNearPoint(const double *pos, double eps) const throw(INTERP_KERNEL::Exception); void getNodeIdsNearPoints(const double *pos, int nbOfNodes, double eps, std::vector& c, std::vector& cI) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index de605df87..92c2f95c4 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -1755,16 +1755,6 @@ void MEDCouplingUMesh::getNodeIdsOfCell(int cellId, std::vector& conn) cons conn.push_back(*w); } -/*! - * Returns coordinates of node with id 'nodeId' and append it in 'coo'. - */ -void MEDCouplingUMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const -{ - const double *cooPtr=_coords->getConstPointer(); - int spaceDim=getSpaceDimension(); - coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1)); -} - std::string MEDCouplingUMesh::simpleRepr() const { static const char msg0[]="No coordinates specified !"; diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 843b9861a..8cb98085a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -70,7 +70,6 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector& conn) const; MEDCOUPLING_EXPORT DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT std::string reprConnectivityOfThis() const; diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx index fcdd1761e..893b547ca 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx @@ -56,11 +56,9 @@ MEDCouplingUMeshDesc *MEDCouplingUMeshDesc::New(const char *meshName, int meshDi return ret; } -/*! - * not implemented - */ MEDCouplingMesh *MEDCouplingUMeshDesc::deepCpy() const { + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } @@ -157,12 +155,7 @@ int MEDCouplingUMeshDesc::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCell void MEDCouplingUMeshDesc::getNodeIdsOfCell(int cellId, std::vector& conn) const { - //not implemented yet. -} - -void MEDCouplingUMeshDesc::getCoordinatesOfNode(int nodeId, std::vector& coo) const -{ - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); } std::string MEDCouplingUMeshDesc::simpleRepr() const @@ -364,14 +357,14 @@ void MEDCouplingUMeshDesc::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBo DataArrayInt *MEDCouplingUMeshDesc::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes) { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); areNodesMerged=false; return 0; } DataArrayInt *MEDCouplingUMeshDesc::mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes) { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); areNodesMerged=false; return 0; } @@ -383,19 +376,19 @@ void MEDCouplingUMeshDesc::tryToShareSameCoordsPermute(const MEDCouplingPointSet MEDCouplingPointSet *MEDCouplingUMeshDesc::buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } MEDCouplingPointSet *MEDCouplingUMeshDesc::buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const { - //not implemented yet + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } MEDCouplingPointSet *MEDCouplingUMeshDesc::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const { - //not implemented yet + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } @@ -406,12 +399,12 @@ DataArrayInt *MEDCouplingUMeshDesc::simplexize(int policy) throw(INTERP_KERNEL:: void MEDCouplingUMeshDesc::findBoundaryNodes(std::vector& nodes) const { - //not implemented yet + throw INTERP_KERNEL::Exception("Not implemented yet !"); } MEDCouplingPointSet *MEDCouplingUMeshDesc::buildBoundaryMesh(bool keepCoords) const { - //not implemented yet + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } @@ -428,18 +421,18 @@ void MEDCouplingUMeshDesc::renumberCells(const int *old2NewBg, bool check) throw void MEDCouplingUMeshDesc::renumberNodes(const int *newNodeNumbers, int newNbOfNodes) { MEDCouplingPointSet::renumberNodes(newNodeNumbers,newNbOfNodes); - //not implemented yet + throw INTERP_KERNEL::Exception("Not implemented yet !"); } MEDCouplingFieldDouble *MEDCouplingUMeshDesc::getMeasureField(bool isAbs) const { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } MEDCouplingFieldDouble *MEDCouplingUMeshDesc::getMeasureFieldOnNode(bool isAbs) const { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } @@ -447,13 +440,13 @@ MEDCouplingFieldDouble *MEDCouplingUMeshDesc::buildOrthogonalField() const { if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !"); - //not implemented yet ! + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } DataArrayInt *MEDCouplingUMeshDesc::zipCoordsTraducer() { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } @@ -478,13 +471,13 @@ void MEDCouplingUMeshDesc::checkFullyDefined() const throw(INTERP_KERNEL::Except MEDCouplingMesh *MEDCouplingUMeshDesc::mergeMyselfWith(const MEDCouplingMesh *other) const { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } DataArrayDouble *MEDCouplingUMeshDesc::getBarycenterAndOwner() const { - //not implemented yet. + throw INTERP_KERNEL::Exception("Not implemented yet !"); return 0; } diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx index ac1424f51..ffbeebf2b 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx @@ -51,7 +51,6 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector& conn) const; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED_DESC; }