From: ageay Date: Thu, 21 Jun 2012 13:20:09 +0000 (+0000) Subject: MEDFileMesh::getNumberOfNodes X-Git-Tag: V6_main_FINAL~630 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4811b4cf72ee02fb43b722d5d2e1eb208bf42268;p=tools%2Fmedcoupling.git MEDFileMesh::getNumberOfNodes --- diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 504301b73..7403cb787 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -1735,6 +1735,14 @@ const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) return l1->getNumberField(); } +int MEDFileUMesh::getNumberOfNodes() const throw(INTERP_KERNEL::Exception) +{ + const DataArrayDouble *coo=_coords; + if(!coo) + throw INTERP_KERNEL::Exception(" MEDFileUMesh::getNumberOfNodes : no coords set !"); + return coo->getNumberOfTuples(); +} + const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -2639,6 +2647,14 @@ void MEDFileCMesh::synchronizeTinyInfoOnLeaves() const (const_cast(cmesh))->setTimeUnit(_dt_unit.c_str()); } +int MEDFileCMesh::getNumberOfNodes() const throw(INTERP_KERNEL::Exception) +{ + const MEDCouplingCMesh *cmesh(_cmesh); + if(!cmesh) + throw INTERP_KERNEL::Exception("MEDFileCMesh::getNumberOfNodes : no cartesian mesh set !"); + return cmesh->getNumberOfNodes(); +} + std::vector MEDFileCMesh::getNonEmptyLevels() const { std::vector ret(1); diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 4b2d571b9..9f77de916 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -51,6 +51,7 @@ namespace ParaMEDMEM double getTimeValue() const { return _time; } void setTimeUnit(const char *unit) { _dt_unit=unit; } const char *getTimeUnit() const { return _dt_unit.c_str(); } + virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception) = 0; virtual std::vector getNonEmptyLevels() const = 0; virtual std::vector getNonEmptyLevelsExt() const = 0; virtual void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); @@ -162,6 +163,7 @@ namespace ParaMEDMEM const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); + int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevels() const; std::vector getNonEmptyLevelsExt() const; std::vector getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception); @@ -238,6 +240,7 @@ namespace ParaMEDMEM DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception); void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception); + int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevels() const; std::vector getNonEmptyLevelsExt() const; const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);