From 30e370a928f879a1c9be2bd685cda6cabec223cf Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 22 Jul 2014 10:33:45 +0200 Subject: [PATCH] Little refactoring of progeny mechanism to avoid if. --- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 20 ++-- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 4 +- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 24 ++--- src/MEDCoupling/MEDCouplingAMRAttribute.hxx | 6 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 11 +-- src/MEDCoupling/MEDCouplingCMesh.hxx | 2 +- .../MEDCouplingCartesianAMRMesh.cxx | 19 ++-- .../MEDCouplingCartesianAMRMesh.hxx | 6 +- .../MEDCouplingCurveLinearMesh.cxx | 5 +- .../MEDCouplingCurveLinearMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingDefinitionTime.cxx | 4 +- src/MEDCoupling/MEDCouplingDefinitionTime.hxx | 4 +- src/MEDCoupling/MEDCouplingExtrudedMesh.cxx | 11 +-- src/MEDCoupling/MEDCouplingExtrudedMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingField.cxx | 8 +- src/MEDCoupling/MEDCouplingField.hxx | 2 +- .../MEDCouplingFieldDiscretization.cxx | 9 +- .../MEDCouplingFieldDiscretization.hxx | 4 +- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 6 +- src/MEDCoupling/MEDCouplingFieldDouble.hxx | 2 +- src/MEDCoupling/MEDCouplingIMesh.cxx | 2 +- src/MEDCoupling/MEDCouplingIMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingMatrix.cxx | 6 +- src/MEDCoupling/MEDCouplingMatrix.hxx | 2 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 2 +- src/MEDCoupling/MEDCouplingMemArray.hxx | 2 +- src/MEDCoupling/MEDCouplingMultiFields.cxx | 8 +- src/MEDCoupling/MEDCouplingMultiFields.hxx | 2 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 5 +- src/MEDCoupling/MEDCouplingPointSet.hxx | 2 +- src/MEDCoupling/MEDCouplingRefCountObject.cxx | 10 ++ src/MEDCoupling/MEDCouplingRefCountObject.hxx | 3 +- .../MEDCouplingTimeDiscretization.cxx | 12 +-- .../MEDCouplingTimeDiscretization.hxx | 4 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 10 +- src/MEDCoupling/MEDCouplingUMesh.hxx | 2 +- src/MEDLoader/MEDFileData.cxx | 11 +-- src/MEDLoader/MEDFileData.hxx | 2 +- src/MEDLoader/MEDFileField.cxx | 77 +++++---------- src/MEDLoader/MEDFileField.hxx | 22 ++--- src/MEDLoader/MEDFileFieldOverView.cxx | 22 ++--- src/MEDLoader/MEDFileFieldOverView.hxx | 12 +-- src/MEDLoader/MEDFileMesh.cxx | 96 +++++++------------ src/MEDLoader/MEDFileMesh.hxx | 14 +-- src/MEDLoader/MEDFileMeshElt.cxx | 14 +-- src/MEDLoader/MEDFileMeshElt.hxx | 2 +- src/MEDLoader/MEDFileMeshLL.cxx | 34 +++---- src/MEDLoader/MEDFileMeshLL.hxx | 8 +- src/MEDLoader/MEDFileParameter.cxx | 20 ++-- src/MEDLoader/MEDFileParameter.hxx | 8 +- src/MEDLoader/SauvReader.cxx | 2 +- src/MEDLoader/SauvReader.hxx | 2 +- src/MEDLoader/SauvUtilities.hxx | 2 +- src/MEDLoader/SauvWriter.cxx | 2 +- src/MEDLoader/SauvWriter.hxx | 2 +- 55 files changed, 226 insertions(+), 351 deletions(-) diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index d4bd0aadd..ec244e6c4 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -583,12 +583,10 @@ std::size_t MEDCoupling1SGTUMesh::getHeapMemorySizeWithoutChildren() const return MEDCoupling1GTUMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCoupling1SGTUMesh::getDirectChildren() const +std::vector MEDCoupling1SGTUMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDCoupling1GTUMesh::getDirectChildren()); - const DataArrayInt *c(_conn); - if(c) - ret.push_back(c); + std::vector ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull()); + ret.push_back((const DataArrayInt *)_conn); return ret; } @@ -2131,15 +2129,11 @@ std::size_t MEDCoupling1DGTUMesh::getHeapMemorySizeWithoutChildren() const return MEDCoupling1GTUMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCoupling1DGTUMesh::getDirectChildren() const +std::vector MEDCoupling1DGTUMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDCoupling1GTUMesh::getDirectChildren()); - const DataArrayInt *c(_conn); - if(c) - ret.push_back(c); - c=_conn_indx; - if(c) - ret.push_back(c); + std::vector ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull()); + ret.push_back((const DataArrayInt *)_conn); + ret.push_back((const DataArrayInt *)_conn_indx); return ret; } diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx index 674d9bcf4..4637c1146 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx @@ -96,7 +96,7 @@ namespace ParaMEDMEM // overload of TimeLabel and RefCountObject MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // overload of MEDCouplingMesh MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED; } MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; @@ -186,7 +186,7 @@ namespace ParaMEDMEM // overload of TimeLabel and RefCountObject MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // overload of MEDCouplingMesh MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED; } MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx index 7f8b5298f..96ed62922 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -329,15 +329,11 @@ std::size_t DataArrayDoubleCollection::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector DataArrayDoubleCollection::getDirectChildren() const +std::vector DataArrayDoubleCollection::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) - { - const DataArrayDouble *pt((*it).first); - if(pt) - ret.push_back(pt); - } + ret.push_back((const DataArrayDouble *)(*it).first); return ret; } @@ -710,15 +706,11 @@ std::size_t MEDCouplingGridCollection::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDCouplingGridCollection::getDirectChildren() const +std::vector MEDCouplingGridCollection::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) - { - const DataArrayDoubleCollection *col((*it).second); - if(col) - ret.push_back(col); - } + ret.push_back((const DataArrayDoubleCollection *)(*it).second); return ret; } @@ -1397,15 +1389,11 @@ std::size_t MEDCouplingAMRAttribute::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDCouplingAMRAttribute::getDirectChildren() const +std::vector MEDCouplingAMRAttribute::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) - { - const MEDCouplingGridCollection *elt(*it); - if(elt) - ret.push_back(elt); - } + ret.push_back((const MEDCouplingGridCollection *)*it); return ret; } diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx index 37857698a..afdf2e63d 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -57,7 +57,7 @@ namespace ParaMEDMEM DataArrayDoubleCollection(const std::vector< std::pair >& fieldNames); DataArrayDoubleCollection(const DataArrayDoubleCollection& other); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; void updateTime() const; static void CheckDiscriminantNames(const std::vector& names); static bool IsConservativeNature(NatureOfField n); @@ -93,7 +93,7 @@ namespace ParaMEDMEM MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames); MEDCouplingGridCollection(const MEDCouplingGridCollection& other, const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; void updateTime() const; private: std::vector< std::pair > > _map_of_dadc; @@ -162,7 +162,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf); // MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; private: MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev); diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 20343e55c..5e7577bce 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -111,15 +111,12 @@ std::size_t MEDCouplingCMesh::getHeapMemorySizeWithoutChildren() const return MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCouplingCMesh::getDirectChildren() const +std::vector MEDCouplingCMesh::getDirectChildrenWithNull() const { std::vector ret; - if(_x_array) - ret.push_back(_x_array); - if(_y_array) - ret.push_back(_y_array); - if(_z_array) - ret.push_back(_z_array); + ret.push_back(_x_array); + ret.push_back(_y_array); + ret.push_back(_z_array); return ret; } diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index ed587c3b2..326b1835e 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -35,7 +35,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return CARTESIAN; } MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx index 84a89c516..84042e037 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -78,11 +78,10 @@ MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatchGen::getMeshSafe() return mesh; } -std::vector MEDCouplingCartesianAMRPatchGen::getDirectChildren() const +std::vector MEDCouplingCartesianAMRPatchGen::getDirectChildrenWithNull() const { std::vector ret; - if((const MEDCouplingCartesianAMRMeshGen *)_mesh) - ret.push_back((const MEDCouplingCartesianAMRMeshGen *)_mesh); + ret.push_back((const MEDCouplingCartesianAMRMeshGen *)_mesh); return ret; } @@ -1706,16 +1705,12 @@ std::size_t MEDCouplingCartesianAMRMeshGen::getHeapMemorySizeWithoutChildren() c return sizeof(MEDCouplingCartesianAMRMeshGen); } -std::vector MEDCouplingCartesianAMRMeshGen::getDirectChildren() const +std::vector MEDCouplingCartesianAMRMeshGen::getDirectChildrenWithNull() const { std::vector ret; - if((const MEDCouplingIMesh *)_mesh) - ret.push_back((const MEDCouplingIMesh *)_mesh); + ret.push_back((const MEDCouplingIMesh *)_mesh); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) - { - if((const MEDCouplingCartesianAMRPatch*)*it) - ret.push_back((const MEDCouplingCartesianAMRPatch*)*it); - } + ret.push_back((const MEDCouplingCartesianAMRPatch*)*it); return ret; } @@ -1972,9 +1967,9 @@ MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh) { } -std::vector MEDCouplingCartesianAMRMesh::getDirectChildren() const +std::vector MEDCouplingCartesianAMRMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDCouplingCartesianAMRMeshGen::getDirectChildren()); + std::vector ret(MEDCouplingCartesianAMRMeshGen::getDirectChildrenWithNull()); return ret; } diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index bee12ea85..52d1747e5 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -60,7 +60,7 @@ namespace ParaMEDMEM const MEDCouplingCartesianAMRMeshGen *getMeshSafe() const; MEDCouplingCartesianAMRMeshGen *getMeshSafe(); private: - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; protected: MEDCouplingAutoRefCountObjectPtr _mesh; }; @@ -202,7 +202,7 @@ namespace ParaMEDMEM virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const = 0; protected: MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; protected: MEDCouplingAutoRefCountObjectPtr _mesh; @@ -249,7 +249,7 @@ namespace ParaMEDMEM MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop); MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh); - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; ~MEDCouplingCartesianAMRMesh(); }; } diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index f54754b37..60ab76f40 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -87,11 +87,10 @@ std::size_t MEDCouplingCurveLinearMesh::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDCouplingCurveLinearMesh::getDirectChildren() const +std::vector MEDCouplingCurveLinearMesh::getDirectChildrenWithNull() const { std::vector ret; - if((const DataArrayDouble *)_coords) - ret.push_back((const DataArrayDouble *)_coords); + ret.push_back((const DataArrayDouble *)_coords); return ret; } diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index 45f153bba..ad789fec6 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -36,7 +36,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return CURVE_LINEAR; } MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx index 3d3bf7cc1..a7c736633 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx @@ -114,7 +114,7 @@ std::size_t MEDCouplingDefinitionTimeSlice::getHeapMemorySizeWithoutChildren() c return 0; } -std::vector MEDCouplingDefinitionTimeSlice::getDirectChildren() const +std::vector MEDCouplingDefinitionTimeSlice::getDirectChildrenWithNull() const { return std::vector(); } @@ -474,7 +474,7 @@ std::size_t MEDCouplingDefinitionTime::getHeapMemorySizeWithoutChildren() const return _slices.capacity()*(sizeof(MEDCouplingDefinitionTimeSlice)+sizeof(int)); } -std::vector MEDCouplingDefinitionTime::getDirectChildren() const +std::vector MEDCouplingDefinitionTime::getDirectChildrenWithNull() const { return std::vector(); } diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.hxx b/src/MEDCoupling/MEDCouplingDefinitionTime.hxx index 638e1b26a..93fa92c57 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.hxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.hxx @@ -52,7 +52,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const = 0; MEDCOUPLING_EXPORT virtual TypeOfTimeDiscretization getTimeType() const = 0; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT bool isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const; MEDCOUPLING_EXPORT bool isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const; MEDCOUPLING_EXPORT bool isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const; @@ -145,7 +145,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingDefinitionTime(); MEDCOUPLING_EXPORT MEDCouplingDefinitionTime(const std::vector& fs, const std::vector& meshRefs, const std::vector >& arrRefs); MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void assign(const MEDCouplingDefinitionTime& other); MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingDefinitionTime& other) const; MEDCOUPLING_EXPORT double getTimeResolution() const { return _eps; } diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index c5de4848c..fb36cb7c8 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -69,15 +69,12 @@ std::size_t MEDCouplingExtrudedMesh::getHeapMemorySizeWithoutChildren() const return MEDCouplingMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCouplingExtrudedMesh::getDirectChildren() const +std::vector MEDCouplingExtrudedMesh::getDirectChildrenWithNull() const { std::vector ret; - if(_mesh2D) - ret.push_back(_mesh2D); - if(_mesh1D) - ret.push_back(_mesh1D); - if(_mesh3D_ids) - ret.push_back(_mesh3D_ids); + ret.push_back(_mesh2D); + ret.push_back(_mesh1D); + ret.push_back(_mesh3D_ids); return ret; } diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index 18e4df385..ef6bb8f6a 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -40,7 +40,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT static MEDCouplingExtrudedMesh *New(); MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); MEDCOUPLING_EXPORT int getNumberOfCells() const; MEDCOUPLING_EXPORT int getNumberOfNodes() const; diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index 1c9ca16a3..bf5c05ac6 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -161,13 +161,11 @@ std::size_t MEDCouplingField::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDCouplingField::getDirectChildren() const +std::vector MEDCouplingField::getDirectChildrenWithNull() const { std::vector ret; - if(_mesh) - ret.push_back(_mesh); - if((const MEDCouplingFieldDiscretization *)_type) - ret.push_back((const MEDCouplingFieldDiscretization *)_type); + ret.push_back(_mesh); + ret.push_back((const MEDCouplingFieldDiscretization *)_type); return ret; } diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 6d4625d70..15f68183b 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -86,7 +86,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // for MED file RW MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index 76344523e..22a30a28a 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -207,7 +207,7 @@ std::size_t MEDCouplingFieldDiscretization::getHeapMemorySizeWithoutChildren() c return 0; } -std::vector MEDCouplingFieldDiscretization::getDirectChildren() const +std::vector MEDCouplingFieldDiscretization::getDirectChildrenWithNull() const { return std::vector(); } @@ -1108,11 +1108,10 @@ std::size_t MEDCouplingFieldDiscretizationPerCell::getHeapMemorySizeWithoutChild return ret; } -std::vector MEDCouplingFieldDiscretizationPerCell::getDirectChildren() const +std::vector MEDCouplingFieldDiscretizationPerCell::getDirectChildrenWithNull() const { - std::vector ret(MEDCouplingFieldDiscretization::getDirectChildren()); - if(_discr_per_cell) - ret.push_back(_discr_per_cell); + std::vector ret(MEDCouplingFieldDiscretization::getDirectChildrenWithNull()); + ret.push_back(_discr_per_cell); return ret; } diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx index 5bb752e0a..17fb76c65 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx @@ -48,7 +48,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void setPrecision(double val) { _precision=val; } MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr); MEDCOUPLING_EXPORT virtual TypeOfField getEnum() const = 0; MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const; @@ -210,7 +210,7 @@ namespace ParaMEDMEM ~MEDCouplingFieldDiscretizationPerCell(); void updateTime() const; std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const; bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index ce42c398f..f144ff785 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -1939,12 +1939,12 @@ std::size_t MEDCouplingFieldDouble::getHeapMemorySizeWithoutChildren() const return MEDCouplingField::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCouplingFieldDouble::getDirectChildren() const +std::vector MEDCouplingFieldDouble::getDirectChildrenWithNull() const { - std::vector ret(MEDCouplingField::getDirectChildren()); + std::vector ret(MEDCouplingField::getDirectChildrenWithNull()); if(_time_discr) { - std::vector ret2(_time_discr->getDirectChildren()); + std::vector ret2(_time_discr->getDirectChildrenWithNull()); ret.insert(ret.end(),ret2.begin(),ret2.end()); } return ret; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 57e24b668..5ec1096a4 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -134,7 +134,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT int getNumberOfValues() const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx index d01d4e95c..02e629e0f 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -821,7 +821,7 @@ std::size_t MEDCouplingIMesh::getHeapMemorySizeWithoutChildren() const return MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCouplingIMesh::getDirectChildren() const +std::vector MEDCouplingIMesh::getDirectChildrenWithNull() const { return std::vector(); } diff --git a/src/MEDCoupling/MEDCouplingIMesh.hxx b/src/MEDCoupling/MEDCouplingIMesh.hxx index d638f738f..166c61143 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.hxx +++ b/src/MEDCoupling/MEDCouplingIMesh.hxx @@ -59,7 +59,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(int ghostLev) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return IMAGE_GRID; } MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx index 7500d226e..bdc26d1e4 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -52,12 +52,10 @@ std::size_t DenseMatrix::getHeapMemorySizeWithoutChildren() const return sizeof(DenseMatrix); } -std::vector DenseMatrix::getDirectChildren() const +std::vector DenseMatrix::getDirectChildrenWithNull() const { std::vector ret; - const DataArrayDouble *pt(_data); - if(pt) - ret.push_back(pt); + ret.push_back((const DataArrayDouble *)_data); return ret; } diff --git a/src/MEDCoupling/MEDCouplingMatrix.hxx b/src/MEDCoupling/MEDCouplingMatrix.hxx index 8f79784b6..f0e86287c 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.hxx +++ b/src/MEDCoupling/MEDCouplingMatrix.hxx @@ -43,7 +43,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT DenseMatrix *deepCpy() const; MEDCOUPLING_EXPORT DenseMatrix *shallowCpy() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; // MEDCOUPLING_EXPORT int getNumberOfRows() const { return _nb_rows; } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index affee9293..9ce46ad0f 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -120,7 +120,7 @@ std::size_t DataArray::getHeapMemorySizeWithoutChildren() const return sz1+sz2+sz3; } -std::vector DataArray::getDirectChildren() const +std::vector DataArray::getDirectChildrenWithNull() const { return std::vector(); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index e4b99ca15..56b93b3f8 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -116,7 +116,7 @@ namespace ParaMEDMEM { public: MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void setName(const std::string& name); MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other); MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index 35bea1a29..fea49d8a3 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -195,15 +195,11 @@ std::size_t MEDCouplingMultiFields::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDCouplingMultiFields::getDirectChildren() const +std::vector MEDCouplingMultiFields::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin();it!=_fs.end();it++) - { - const MEDCouplingFieldDouble *curF(*it); - if(curF) - ret.push_back(curF); - } + ret.push_back((const MEDCouplingFieldDouble *)*it); return ret; } diff --git a/src/MEDCoupling/MEDCouplingMultiFields.hxx b/src/MEDCoupling/MEDCouplingMultiFields.hxx index 3cf018017..d22a5f9df 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.hxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.hxx @@ -60,7 +60,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual std::vector getDifferentArrays(std::vector< std::vector >& refs) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const; MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& ft, const std::vector& ms, diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 5b221e9d4..92870db59 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -80,11 +80,10 @@ std::size_t MEDCouplingPointSet::getHeapMemorySizeWithoutChildren() const return MEDCouplingMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCouplingPointSet::getDirectChildren() const +std::vector MEDCouplingPointSet::getDirectChildrenWithNull() const { std::vector ret; - if(_coords) - ret.push_back(_coords); + ret.push_back(_coords); return ret; } diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 77fe73581..c9bdc4e55 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -53,7 +53,7 @@ namespace ParaMEDMEM public: MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT int getNumberOfNodes() const; MEDCOUPLING_EXPORT int getSpaceDimension() const; MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords); diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.cxx b/src/MEDCoupling/MEDCouplingRefCountObject.cxx index 5284c02bd..62d0f7f4b 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.cxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.cxx @@ -205,6 +205,16 @@ std::string BigMemoryObject::getHeapMemorySizeStr() const return oss.str(); } +std::vector BigMemoryObject::getDirectChildren() const +{ + std::vector ret; + std::vector retWithNull(getDirectChildrenWithNull()); + for(std::vector::const_iterator it=retWithNull.begin();it!=retWithNull.end();it++) + if(*it) + ret.push_back(*it); + return ret; +} + BigMemoryObject::~BigMemoryObject() { } diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.hxx b/src/MEDCoupling/MEDCouplingRefCountObject.hxx index 31a23be0a..2c1e16400 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.hxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.hxx @@ -67,11 +67,12 @@ namespace ParaMEDMEM public: MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const; MEDCOUPLING_EXPORT std::string getHeapMemorySizeStr() const; + MEDCOUPLING_EXPORT std::vector getDirectChildren() const; MEDCOUPLING_EXPORT std::vector getAllTheProgeny() const; MEDCOUPLING_EXPORT bool isObjectInTheProgeny(const BigMemoryObject *obj) const; MEDCOUPLING_EXPORT static std::size_t GetHeapMemorySizeOfObjs(const std::vector& objs); MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const = 0; - MEDCOUPLING_EXPORT virtual std::vector getDirectChildren() const = 0; + MEDCOUPLING_EXPORT virtual std::vector getDirectChildrenWithNull() const = 0; MEDCOUPLING_EXPORT virtual ~BigMemoryObject(); private: static std::size_t GetHeapMemoryOfSet(std::set& s1, std::set& s2); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 718507f27..e8f299a12 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -99,11 +99,10 @@ std::size_t MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren() co return ret; } -std::vector MEDCouplingTimeDiscretization::getDirectChildren() const +std::vector MEDCouplingTimeDiscretization::getDirectChildrenWithNull() const { std::vector ret; - if(_array) - ret.push_back(_array); + ret.push_back(_array); return ret; } @@ -2230,11 +2229,10 @@ std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySizeWithoutChildren() const return MEDCouplingTimeDiscretization::getHeapMemorySizeWithoutChildren(); } -std::vector MEDCouplingTwoTimeSteps::getDirectChildren() const +std::vector MEDCouplingTwoTimeSteps::getDirectChildrenWithNull() const { - std::vector ret(MEDCouplingTimeDiscretization::getDirectChildren()); - if(_end_array) - ret.push_back(_end_array); + std::vector ret(MEDCouplingTimeDiscretization::getDirectChildrenWithNull()); + ret.push_back(_end_array); return ret; } diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index 4996c472d..43f2696f2 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -42,7 +42,7 @@ namespace ParaMEDMEM public: MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT virtual std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT virtual std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type); MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; } MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; } @@ -370,7 +370,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh); MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other); MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other); MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 0b6f04728..d8ba41453 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -122,13 +122,11 @@ std::size_t MEDCouplingUMesh::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDCouplingUMesh::getDirectChildren() const +std::vector MEDCouplingUMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDCouplingPointSet::getDirectChildren()); - if(_nodal_connec) - ret.push_back(_nodal_connec); - if(_nodal_connec_index) - ret.push_back(_nodal_connec_index); + std::vector ret(MEDCouplingPointSet::getDirectChildrenWithNull()); + ret.push_back(_nodal_connec); + ret.push_back(_nodal_connec_index); return ret; } diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index f43c356bf..7f3aa5d7b 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -47,7 +47,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED; } MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index ffac18050..7c920b4d1 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -53,15 +53,12 @@ std::size_t MEDFileData::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDFileData::getDirectChildren() const +std::vector MEDFileData::getDirectChildrenWithNull() const { std::vector ret; - if((const MEDFileFields *)_fields) - ret.push_back((const MEDFileFields *)_fields); - if((const MEDFileMeshes *)_meshes) - ret.push_back((const MEDFileMeshes *)_meshes); - if((const MEDFileParameters *)_params) - ret.push_back((const MEDFileParameters *)_params); + ret.push_back((const MEDFileFields *)_fields); + ret.push_back((const MEDFileMeshes *)_meshes); + ret.push_back((const MEDFileParameters *)_params); return ret; } diff --git a/src/MEDLoader/MEDFileData.hxx b/src/MEDLoader/MEDFileData.hxx index a41825031..38e3a5b76 100644 --- a/src/MEDLoader/MEDFileData.hxx +++ b/src/MEDLoader/MEDFileData.hxx @@ -38,7 +38,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileData *New(); MEDLOADER_EXPORT MEDFileData *deepCpy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileFields *getFields() const; MEDLOADER_EXPORT MEDFileMeshes *getMeshes() const; MEDLOADER_EXPORT MEDFileParameters *getParams() const; diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index e7ef086c9..702929cfd 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -114,7 +114,7 @@ std::size_t MEDFileFieldLoc::getHeapMemorySizeWithoutChildren() const return (_ref_coo.capacity()+_gs_coo.capacity()+_w.capacity())*sizeof(double)+_name.capacity(); } -std::vector MEDFileFieldLoc::getDirectChildren() const +std::vector MEDFileFieldLoc::getDirectChildrenWithNull() const { return std::vector(); } @@ -418,7 +418,7 @@ std::size_t MEDFileFieldPerMeshPerTypePerDisc::getHeapMemorySizeWithoutChildren( return _profile.capacity()+_localization.capacity()+5*sizeof(int); } -std::vector MEDFileFieldPerMeshPerTypePerDisc::getDirectChildren() const +std::vector MEDFileFieldPerMeshPerTypePerDisc::getDirectChildrenWithNull() const { return std::vector(); } @@ -989,15 +989,11 @@ std::size_t MEDFileFieldPerMeshPerType::getHeapMemorySizeWithoutChildren() const return _field_pm_pt_pd.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); } -std::vector MEDFileFieldPerMeshPerType::getDirectChildren() const +std::vector MEDFileFieldPerMeshPerType::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) - { - const MEDFileFieldPerMeshPerTypePerDisc *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)*it); return ret; } @@ -1551,15 +1547,11 @@ std::size_t MEDFileFieldPerMesh::getHeapMemorySizeWithoutChildren() const return _mesh_name.capacity()+_field_pm_pt.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType >); } -std::vector MEDFileFieldPerMesh::getDirectChildren() const +std::vector MEDFileFieldPerMesh::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) - { - const MEDFileFieldPerMeshPerType *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileFieldPerMeshPerType *)*it); return ret; } @@ -2540,21 +2532,13 @@ std::size_t MEDFileFieldGlobs::getHeapMemorySizeWithoutChildren() const return _file_name.capacity()+_pfls.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr)+_locs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); } -std::vector MEDFileFieldGlobs::getDirectChildren() const +std::vector MEDFileFieldGlobs::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) - { - const DataArrayInt *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const DataArrayInt *)*it); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++) - { - const MEDFileFieldLoc *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileFieldLoc *)*it); return ret; } @@ -3009,11 +2993,10 @@ std::size_t MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDFileFieldGlobsReal::getDirectChildren() const +std::vector MEDFileFieldGlobsReal::getDirectChildrenWithNull() const { std::vector ret; - if((const MEDFileFieldGlobs *)_globals) - ret.push_back((const MEDFileFieldGlobs *)_globals); + ret.push_back((const MEDFileFieldGlobs *)_globals); return ret; } @@ -4248,17 +4231,13 @@ std::size_t MEDFileAnyTypeField1TSWithoutSDA::getHeapMemorySizeWithoutChildren() return _dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh >); } -std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirectChildren() const +std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirectChildrenWithNull() const { std::vector ret; if(getUndergroundDataArray()) ret.push_back(getUndergroundDataArray()); for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) - { - const MEDFileFieldPerMesh *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileFieldPerMesh *)*it); return ret; } @@ -5647,11 +5626,10 @@ std::size_t MEDFileAnyTypeField1TS::getHeapMemorySizeWithoutChildren() const return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren(); } -std::vector MEDFileAnyTypeField1TS::getDirectChildren() const +std::vector MEDFileAnyTypeField1TS::getDirectChildrenWithNull() const { - std::vector ret(MEDFileFieldGlobsReal::getDirectChildren()); - if((const MEDFileAnyTypeField1TSWithoutSDA *)_content) - ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)_content); + std::vector ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull()); + ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)_content); return ret; } @@ -6754,15 +6732,11 @@ std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildr return ret; } -std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildren() const +std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) - { - const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it); return ret; } @@ -8232,11 +8206,10 @@ std::size_t MEDFileAnyTypeFieldMultiTS::getHeapMemorySizeWithoutChildren() const return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren(); } -std::vector MEDFileAnyTypeFieldMultiTS::getDirectChildren() const +std::vector MEDFileAnyTypeFieldMultiTS::getDirectChildrenWithNull() const { - std::vector ret(MEDFileFieldGlobsReal::getDirectChildren()); - if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content) - ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content); + std::vector ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull()); + ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content); return ret; } @@ -9411,15 +9384,11 @@ std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileFields::getDirectChildren() const +std::vector MEDFileFields::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) - { - const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it); return ret; } diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index f912ccee7..e7539a889 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -57,7 +57,7 @@ namespace ParaMEDMEM static MEDFileFieldLoc *New(med_idt fid, int id); static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldLoc *deepCpy() const; MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; } MEDLOADER_EXPORT void writeLL(med_idt fid) const; @@ -101,7 +101,7 @@ namespace ParaMEDMEM static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId); static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMeshPerTypePerDisc *deepCpy(MEDFileFieldPerMeshPerType *father) const; void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); @@ -177,7 +177,7 @@ namespace ParaMEDMEM static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMeshPerType *deepCpy(MEDFileFieldPerMesh *father) const; void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); @@ -233,7 +233,7 @@ namespace ParaMEDMEM static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMesh *deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const; void simpleRepr(int bkOffset,std::ostream& oss, int id) const; void copyTinyInfoFrom(const MEDCouplingMesh *mesh); @@ -307,7 +307,7 @@ namespace ParaMEDMEM static MEDFileFieldGlobs *New(const std::string& fname); static MEDFileFieldGlobs *New(); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldGlobs *deepCpy() const; MEDFileFieldGlobs *shallowCpyPart(const std::vector& pfls, const std::vector& locs) const; MEDFileFieldGlobs *deepCpyPart(const std::vector& pfls, const std::vector& locs) const; @@ -367,7 +367,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDFileFieldGlobsReal(const std::string& fname); MEDLOADER_EXPORT MEDFileFieldGlobsReal(); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT void simpleReprGlobs(std::ostream& oss) const; MEDLOADER_EXPORT void resetContent(); MEDLOADER_EXPORT void shallowCpyGlobs(const MEDFileFieldGlobsReal& other); @@ -489,7 +489,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT void setInfo(const std::vector& infos); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); @@ -675,7 +675,7 @@ namespace ParaMEDMEM //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf MEDLOADER_EXPORT void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const; @@ -784,7 +784,7 @@ namespace ParaMEDMEM MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCpy() const; MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr > splitComponents() const; MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr > splitDiscretizations() const; @@ -916,7 +916,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *deepCpy() const; MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitComponents() const; MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitDiscretizations() const; @@ -1077,7 +1077,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileFields *New(); MEDLOADER_EXPORT static MEDFileFields *New(const std::string& fileName, bool loadAll=true); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileFields *deepCpy() const; MEDLOADER_EXPORT MEDFileFields *shallowCpy() const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index b6b8ca5dc..c3317e295 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -47,7 +47,7 @@ std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileMeshStruct::getDirectChildren() const +std::vector MEDFileMeshStruct::getDirectChildrenWithNull() const { return std::vector(); } @@ -158,7 +158,7 @@ std::size_t MEDMeshMultiLev::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDMeshMultiLev::getDirectChildren() const +std::vector MEDMeshMultiLev::getDirectChildrenWithNull() const { return std::vector(); } @@ -1772,12 +1772,10 @@ std::size_t MEDFileField1TSStructItem2::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileField1TSStructItem2::getDirectChildren() const +std::vector MEDFileField1TSStructItem2::getDirectChildrenWithNull() const { std::vector ret; - const DataArrayInt *pfl(_pfl); - if(pfl) - ret.push_back(pfl); + ret.push_back((const DataArrayInt *)_pfl); return ret; } @@ -1988,7 +1986,7 @@ std::size_t MEDFileField1TSStructItem::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileField1TSStructItem::getDirectChildren() const +std::vector MEDFileField1TSStructItem::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++) @@ -2171,7 +2169,7 @@ std::size_t MEDFileField1TSStruct::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileField1TSStruct::getDirectChildren() const +std::vector MEDFileField1TSStruct::getDirectChildrenWithNull() const { std::vector ret; for(std::vector::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++) @@ -2313,18 +2311,14 @@ std::size_t MEDFileFastCellSupportComparator::getHeapMemorySizeWithoutChildren() return ret; } -std::vector MEDFileFastCellSupportComparator::getDirectChildren() const +std::vector MEDFileFastCellSupportComparator::getDirectChildrenWithNull() const { std::vector ret; const MEDFileMeshStruct *mst(_mesh_comp); if(mst) ret.push_back(mst); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++) - { - const MEDFileField1TSStruct *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileField1TSStruct *)*it); return ret; } diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index f273cdab5..7674889be 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -51,7 +51,7 @@ namespace ParaMEDMEM public: MEDLOADER_EXPORT static MEDFileMeshStruct *New(const MEDFileMesh *mesh); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; const MEDFileMesh *getTheMesh() const { return _mesh; } int getNumberOfNodes() const { return _nb_nodes; } bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const; @@ -76,7 +76,7 @@ namespace ParaMEDMEM { public: std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; public: static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs); @@ -213,7 +213,7 @@ namespace ParaMEDMEM void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); // MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; // const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const; INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; } @@ -246,7 +246,7 @@ namespace ParaMEDMEM void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); bool operator==(const MEDFileField1TSStructItem& other) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; bool isEntityCell() const; bool isComputed() const { return _computed; } TypeOfField getType() const { return _type; } @@ -273,7 +273,7 @@ namespace ParaMEDMEM static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst); void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const; bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt); @@ -299,7 +299,7 @@ namespace ParaMEDMEM bool isEqual(const MEDFileAnyTypeFieldMultiTS *other); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; private: MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref); private: diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 90375565a..95a947585 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -56,7 +56,7 @@ std::size_t MEDFileMesh::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileMesh::getDirectChildren() const +std::vector MEDFileMesh::getDirectChildrenWithNull() const { return std::vector(); } @@ -1990,22 +1990,16 @@ std::size_t MEDFileUMesh::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileUMesh::getDirectChildren() const +std::vector MEDFileUMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDFileMesh::getDirectChildren()); - if((const DataArrayDouble*)_coords) - ret.push_back((const DataArrayDouble*)_coords); - if((const DataArrayInt *)_fam_coords) - ret.push_back((const DataArrayInt *)_fam_coords); - if((const DataArrayInt *)_num_coords) - ret.push_back((const DataArrayInt *)_num_coords); - if((const DataArrayInt *)_rev_num_coords) - ret.push_back((const DataArrayInt *)_rev_num_coords); - if((const DataArrayAsciiChar *)_name_coords) - ret.push_back((const DataArrayAsciiChar *)_name_coords); + std::vector ret(MEDFileMesh::getDirectChildrenWithNull()); + ret.push_back((const DataArrayDouble*)_coords); + ret.push_back((const DataArrayInt *)_fam_coords); + ret.push_back((const DataArrayInt *)_num_coords); + ret.push_back((const DataArrayInt *)_rev_num_coords); + ret.push_back((const DataArrayAsciiChar *)_name_coords); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) - if((const MEDFileUMeshSplitL1*) *it) - ret.push_back((const MEDFileUMeshSplitL1*) *it); + ret.push_back((const MEDFileUMeshSplitL1*) *it); return ret; } @@ -3976,33 +3970,21 @@ std::size_t MEDFileStructuredMesh::getHeapMemorySizeWithoutChildren() const return MEDFileMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDFileStructuredMesh::getDirectChildren() const -{ - std::vector ret(MEDFileMesh::getDirectChildren()); - if((const DataArrayInt *)_fam_nodes) - ret.push_back((const DataArrayInt *)_fam_nodes); - if((const DataArrayInt *)_num_nodes) - ret.push_back((const DataArrayInt *)_num_nodes); - if((const DataArrayAsciiChar *)_names_nodes) - ret.push_back((const DataArrayAsciiChar *)_names_nodes); - if((const DataArrayInt *)_fam_cells) - ret.push_back((const DataArrayInt *)_fam_cells); - if((const DataArrayInt *)_num_cells) - ret.push_back((const DataArrayInt *)_num_cells); - if((const DataArrayAsciiChar *)_names_cells) - ret.push_back((const DataArrayAsciiChar *)_names_cells); - if((const DataArrayInt *)_fam_faces) - ret.push_back((const DataArrayInt *)_fam_faces); - if((const DataArrayInt *)_num_faces) - ret.push_back((const DataArrayInt *)_num_faces); - if((const DataArrayInt *)_rev_num_nodes) - 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); - if((const MEDCoupling1SGTUMesh*)_faces_if_necessary) - ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary); +std::vector MEDFileStructuredMesh::getDirectChildrenWithNull() const +{ + std::vector ret(MEDFileMesh::getDirectChildrenWithNull()); + ret.push_back((const DataArrayInt *)_fam_nodes); + ret.push_back((const DataArrayInt *)_num_nodes); + ret.push_back((const DataArrayAsciiChar *)_names_nodes); + ret.push_back((const DataArrayInt *)_fam_cells); + ret.push_back((const DataArrayInt *)_num_cells); + ret.push_back((const DataArrayAsciiChar *)_names_cells); + ret.push_back((const DataArrayInt *)_fam_faces); + ret.push_back((const DataArrayInt *)_num_faces); + ret.push_back((const DataArrayInt *)_rev_num_nodes); + ret.push_back((const DataArrayAsciiChar *)_names_faces); + ret.push_back((const DataArrayInt *)_rev_num_cells); + ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary); return ret; } @@ -5067,11 +5049,10 @@ std::size_t MEDFileCMesh::getHeapMemorySizeWithoutChildren() const return MEDFileStructuredMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDFileCMesh::getDirectChildren() const +std::vector MEDFileCMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDFileStructuredMesh::getDirectChildren()); - if((const MEDCouplingCMesh *)_cmesh) - ret.push_back((const MEDCouplingCMesh *)_cmesh); + std::vector ret(MEDFileStructuredMesh::getDirectChildrenWithNull()); + ret.push_back((const MEDCouplingCMesh *)_cmesh); return ret; } @@ -5324,11 +5305,10 @@ std::size_t MEDFileCurveLinearMesh::getHeapMemorySizeWithoutChildren() const return MEDFileStructuredMesh::getHeapMemorySizeWithoutChildren(); } -std::vector MEDFileCurveLinearMesh::getDirectChildren() const +std::vector MEDFileCurveLinearMesh::getDirectChildrenWithNull() const { - std::vector ret(MEDFileStructuredMesh::getDirectChildren()); - if((const MEDCouplingCurveLinearMesh *)_clmesh) - ret.push_back((const MEDCouplingCurveLinearMesh *)_clmesh); + std::vector ret(MEDFileStructuredMesh::getDirectChildrenWithNull()); + ret.push_back((const MEDCouplingCurveLinearMesh *)_clmesh); return ret; } @@ -5537,15 +5517,11 @@ std::size_t MEDFileMeshMultiTS::getHeapMemorySizeWithoutChildren() const return _mesh_one_ts.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); } -std::vector MEDFileMeshMultiTS::getDirectChildren() const +std::vector MEDFileMeshMultiTS::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) - { - const MEDFileMesh *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileMesh *)*it); return ret; } @@ -5824,15 +5800,11 @@ std::size_t MEDFileMeshes::getHeapMemorySizeWithoutChildren() const return _meshes.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr)); } -std::vector MEDFileMeshes::getDirectChildren() const +std::vector MEDFileMeshes::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_meshes.begin();it!=_meshes.end();it++) - { - const MEDFileMeshMultiTS *cur(*it); - if(cur) - ret.push_back(cur); - } + ret.push_back((const MEDFileMeshMultiTS *)*it); return ret; } diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index ca36d3f87..c2a0eeab7 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -40,7 +40,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *deepCpy() const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0; @@ -201,7 +201,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileUMesh *New(); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; MEDLOADER_EXPORT MEDFileMesh *deepCpy() const; MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; @@ -309,7 +309,7 @@ namespace ParaMEDMEM friend class MEDFileMesh; public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const; MEDLOADER_EXPORT int getMinFamilyIdInArrays() const; @@ -374,7 +374,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; MEDLOADER_EXPORT MEDFileMesh *deepCpy() const; MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; @@ -405,7 +405,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; MEDLOADER_EXPORT MEDFileMesh *deepCpy() const; MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; @@ -435,7 +435,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName); MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCpy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string getName() const; MEDLOADER_EXPORT void setName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair >& modifTab); @@ -461,7 +461,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileMeshes *New(const std::string& fileName); MEDLOADER_EXPORT MEDFileMeshes *deepCpy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index 7d30a60a1..00980e5b1 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -45,17 +45,13 @@ std::size_t MEDFileUMeshPerType::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDFileUMeshPerType::getDirectChildren() const +std::vector MEDFileUMeshPerType::getDirectChildrenWithNull() const { std::vector ret; - if((const MEDCoupling1GTUMesh *)_m) - ret.push_back((const MEDCoupling1GTUMesh *)_m); - if((const DataArrayInt *)_num) - ret.push_back((const DataArrayInt *)_num); - if((const DataArrayInt *)_fam) - ret.push_back((const DataArrayInt *)_fam); - if((const DataArrayAsciiChar *)_names) - ret.push_back((const DataArrayAsciiChar *)_names); + ret.push_back((const MEDCoupling1GTUMesh *)_m); + ret.push_back((const DataArrayInt *)_num); + ret.push_back((const DataArrayInt *)_fam); + ret.push_back((const DataArrayAsciiChar *)_names); return ret; } diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index 5b497a8a2..93be1e338 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -40,7 +40,7 @@ namespace ParaMEDMEM static MEDFileUMeshPerType *New(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType geoElt2, MEDFileMeshReadSelector *mrs); static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; int getDim() const; MEDCoupling1GTUMesh *getMesh() const { return const_cast((const MEDCoupling1GTUMesh *)_m); } const DataArrayInt *getFam() const { return _fam; } diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 79493967f..bd8aff2c4 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -45,7 +45,7 @@ std::size_t MEDFileMeshL2::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDFileMeshL2::getDirectChildren() const +std::vector MEDFileMeshL2::getDirectChildrenWithNull() const { return std::vector(); } @@ -512,12 +512,10 @@ void MEDFileUMeshPermCompute::updateTime() const _num_time=_st->_num->getTimeOfThis(); } -std::vector MEDFileUMeshPermCompute::getDirectChildren() const +std::vector MEDFileUMeshPermCompute::getDirectChildrenWithNull() const { std::vector ret; - const MEDCouplingUMesh *elt(_m); - if(elt) - ret.push_back(elt); + ret.push_back((const MEDCouplingUMesh *)_m); return ret; } @@ -607,19 +605,15 @@ std::size_t MEDFileUMeshSplitL1::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector MEDFileUMeshSplitL1::getDirectChildren() const +std::vector MEDFileUMeshSplitL1::getDirectChildrenWithNull() const { std::vector ret; ret.push_back(&_m_by_types); ret.push_back(&_m); - if((const DataArrayInt*)_fam) - ret.push_back((const DataArrayInt*)_fam); - if((const DataArrayInt*)_num) - ret.push_back((const DataArrayInt*)_num); - if((const DataArrayInt*)_rev_num) - ret.push_back((const DataArrayInt*)_rev_num); - if((const DataArrayAsciiChar*)_names) - ret.push_back((const DataArrayAsciiChar*)_names); + ret.push_back((const DataArrayInt*)_fam); + ret.push_back((const DataArrayInt*)_num); + ret.push_back((const DataArrayInt*)_rev_num); + ret.push_back((const DataArrayAsciiChar*)_names); return ret; } @@ -1214,18 +1208,12 @@ std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() con return ret; } -std::vector MEDFileUMeshAggregateCompute::getDirectChildren() const +std::vector MEDFileUMeshAggregateCompute::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) - { - const MEDCoupling1GTUMesh *cur(*it); - if(cur) - ret.push_back(cur); - } - const MEDCouplingUMesh *m(_m); - if(m) - ret.push_back(m); + ret.push_back((const MEDCoupling1GTUMesh *)*it); + ret.push_back((const MEDCouplingUMesh *)_m); return ret; } diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index f353a7b75..ffb34e35a 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -43,7 +43,7 @@ namespace ParaMEDMEM public: MEDFileMeshL2(); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; const char *getName() const { return _name.getReprForWrite(); } const char *getDescription() const { return _description.getReprForWrite(); } const char *getUnivName() const { return _univ_name.getReprForWrite(); } @@ -130,7 +130,7 @@ namespace ParaMEDMEM operator MEDCouplingUMesh *() const; void operator=(MEDCouplingUMesh *m); void updateTime() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; std::size_t getHeapMemorySizeWithoutChildren() const; private: const MEDFileUMeshSplitL1 *_st; @@ -154,7 +154,7 @@ namespace ParaMEDMEM void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const; std::size_t getTimeOfThis() const; std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileUMeshAggregateCompute deepCpy(DataArrayDouble *coords) const; bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const; void clearNonDiscrAttributes() const; @@ -186,7 +186,7 @@ namespace ParaMEDMEM MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld); void setName(const std::string& name); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileUMeshSplitL1 *deepCpy(DataArrayDouble *coords) const; void setCoords(DataArrayDouble *coords); bool isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const; diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx index 3f1bc8a77..e50d32600 100644 --- a/src/MEDLoader/MEDFileParameter.cxx +++ b/src/MEDLoader/MEDFileParameter.cxx @@ -72,7 +72,7 @@ std::size_t MEDFileParameterDouble1TSWTI::getHeapMemorySizeWithoutChildren() con return sizeof(MEDFileParameterDouble1TSWTI); } -std::vector MEDFileParameterDouble1TSWTI::getDirectChildren() const +std::vector MEDFileParameterDouble1TSWTI::getDirectChildrenWithNull() const { return std::vector(); } @@ -350,7 +350,7 @@ std::size_t MEDFileParameterDouble1TS::getHeapMemorySizeWithoutChildren() const return getHeapMemSizeOfStrings()+sizeof(MEDFileParameterDouble1TS); } -std::vector MEDFileParameterDouble1TS::getDirectChildren() const +std::vector MEDFileParameterDouble1TS::getDirectChildrenWithNull() const { return std::vector(); } @@ -486,15 +486,11 @@ std::size_t MEDFileParameterMultiTS::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileParameterMultiTS::getDirectChildren() const +std::vector MEDFileParameterMultiTS::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) - { - const MEDFileParameter1TS *elt(*it); - if(elt) - ret.push_back(elt); - } + ret.push_back((const MEDFileParameter1TS *)*it); return ret; } @@ -742,15 +738,11 @@ std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const return ret; } -std::vector MEDFileParameters::getDirectChildren() const +std::vector MEDFileParameters::getDirectChildrenWithNull() const { std::vector ret; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_params.begin();it!=_params.end();it++) - { - const MEDFileParameterMultiTS *elt(*it); - if(elt) - ret.push_back(elt); - } + ret.push_back((const MEDFileParameterMultiTS *)*it); return ret; } diff --git a/src/MEDLoader/MEDFileParameter.hxx b/src/MEDLoader/MEDFileParameter.hxx index c95432dea..c7a2b96d1 100644 --- a/src/MEDLoader/MEDFileParameter.hxx +++ b/src/MEDLoader/MEDFileParameter.hxx @@ -63,7 +63,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT double getValue() const { return _arr; } MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT void readValue(med_idt fid, const std::string& name); MEDLOADER_EXPORT std::string simpleRepr() const; protected: @@ -106,7 +106,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual std::string simpleRepr() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; @@ -126,7 +126,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; @@ -158,7 +158,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static MEDFileParameters *New(); MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileParameters *deepCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index 9b0fce3b8..f530d1f2d 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -86,7 +86,7 @@ std::size_t SauvReader::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector SauvReader::getDirectChildren() const +std::vector SauvReader::getDirectChildrenWithNull() const { return std::vector(); } diff --git a/src/MEDLoader/SauvReader.hxx b/src/MEDLoader/SauvReader.hxx index 533ae0ba4..e937cbf92 100644 --- a/src/MEDLoader/SauvReader.hxx +++ b/src/MEDLoader/SauvReader.hxx @@ -52,7 +52,7 @@ class SauvReader : public ParaMEDMEM::RefCountObject private: std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; void readRecord2(); void readRecord4(); void readRecord7(); diff --git a/src/MEDLoader/SauvUtilities.hxx b/src/MEDLoader/SauvUtilities.hxx index 261d529df..6bb27e88f 100644 --- a/src/MEDLoader/SauvUtilities.hxx +++ b/src/MEDLoader/SauvUtilities.hxx @@ -111,7 +111,7 @@ namespace SauvUtilities virtual std::string getName() const = 0; protected: std::size_t getHeapMemorySizeWithoutChildren() const { return 0; } - std::vector getDirectChildren() const { return std::vector(); } + std::vector getDirectChildrenWithNull() const { return std::vector(); } protected: std::string _fileName, _curLocale; int _iRead, _nbToRead; diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 815b94646..eef47c9f4 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -226,7 +226,7 @@ std::size_t SauvWriter::getHeapMemorySizeWithoutChildren() const return 0; } -std::vector SauvWriter::getDirectChildren() const +std::vector SauvWriter::getDirectChildrenWithNull() const { return std::vector(); } diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index b489e0015..c810a7f13 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -54,7 +54,7 @@ namespace ParaMEDMEM private: SauvWriter(); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; /*! * \brief Class representing a GIBI sub-mesh (described in the pile 1 of the SAUVE file). * It stands for a named med sub-mesh (family, etc) and contains either cell IDs or other sub-meshes. -- 2.39.2