From be455141782cc64296823222f1818469871ab6aa Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 20 Jul 2011 10:38:15 +0000 Subject: [PATCH] *** empty log message *** --- src/MEDLoader/MEDFileMesh.cxx | 41 +++++++++++++++++++++++++++++++---- src/MEDLoader/MEDFileMesh.hxx | 3 ++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 023da5e46..8f11c7819 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -577,6 +577,15 @@ std::string MEDFileMesh::getFamilyNameGivenId(int id) const throw(INTERP_KERNEL: throw INTERP_KERNEL::Exception(oss.str().c_str()); } +std::string MEDFileMesh::simpleRepr() const +{ + std::ostringstream oss; + oss << "(*************************************)\n(* GENERAL INFORMATION ON THE MESH : *)\n(*************************************)\n"; + oss << "- Name of the mesh : <<" << getName() << ">>\n"; + oss << "- Description associated to the mesh : " << getDescription() << std::endl; + return oss.str(); +} + DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector tmp(1); @@ -730,6 +739,19 @@ void MEDFileMesh::dealWithTinyInfo(const MEDCouplingMesh *m) throw(INTERP_KERNEL } } +void MEDFileMesh::getFamilyRepr(std::ostream& oss) const +{ + oss << "(**************************)\n(* FAMILIES OF THE MESH : *)\n(**************************)\n"; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + { + oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl; + oss << " - Groups lying on this family : "; + std::vector grps=getGroupsOnFamily((*it).first.c_str()); + std::copy(grps.begin(),grps.end(),std::ostream_iterator(oss," ")); + oss << std::endl << std::endl; + } +} + MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception) { MEDFileUtilities::CheckFileForRead(fileName); @@ -1083,8 +1105,7 @@ int MEDFileUMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) std::string MEDFileUMesh::simpleRepr() const { std::ostringstream oss; - oss << "(*************************************)\n(* GENERAL INFORMATION ON THE MESH : *)\n(*************************************)\n"; - oss << "- Name of the mesh : <<" << getName() << ">>\n"; + oss << MEDFileMesh::simpleRepr(); const DataArrayDouble *coo=_coords; oss << "- The dimension of the space is "; static const char MSG1[]= "*** NO COORDS SET ***"; @@ -1094,7 +1115,6 @@ std::string MEDFileUMesh::simpleRepr() const else oss << MSG1 << std::endl; oss << "- Type of the mesh : UNSTRUCTURED\n"; - oss << "- Description associated to the mesh : " << getDescription() << std::endl; oss << "- Number of nodes : "; if(coo) oss << _coords->getNumberOfTuples() << std::endl; @@ -1114,7 +1134,19 @@ std::string MEDFileUMesh::simpleRepr() const else oss << MSG2 << std::endl; } - oss << "- Number of families : " << _families.size() << std::endl; + oss << "- Number of families : " << _families.size() << std::endl << std::endl; + if(coo) + { + oss << "(***********************)\n(* NODES OF THE MESH : *)\n(***********************)\n"; + oss << "- Names of coordinates :" << std::endl; + std::vector vars=coo->getVarsOnComponent(); + std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); + oss << std::endl << "- Units of coordinates : " << std::endl; + std::vector units=coo->getUnitsOnComponent(); + std::copy(units.begin(),units.end(),std::ostream_iterator(oss," ")); + } + oss << std::endl << std::endl; + getFamilyRepr(oss); return oss.str(); } @@ -1626,6 +1658,7 @@ int MEDFileCMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) std::string MEDFileCMesh::simpleRepr() const { + return MEDFileMesh::simpleRepr(); } std::string MEDFileCMesh::advancedRepr() const diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 32f4edfc6..8fc056629 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -85,7 +85,7 @@ namespace ParaMEDMEM std::vector getFamiliesIds(const std::vector& famNames) const throw(INTERP_KERNEL::Exception); std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception); virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception) = 0; - virtual std::string simpleRepr() const = 0; + virtual std::string simpleRepr() const; virtual std::string advancedRepr() const = 0; // virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) throw(INTERP_KERNEL::Exception); @@ -106,6 +106,7 @@ namespace ParaMEDMEM MEDFileMesh(); void dealWithTinyInfo(const MEDCouplingMesh *m) throw(INTERP_KERNEL::Exception); virtual void synchronizeTinyInfoOnLeaves() const = 0; + void getFamilyRepr(std::ostream& oss) const; virtual void appendFamilyEntries(const std::set& famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp); protected: -- 2.39.2