return _father->getMeshName();
}
+void MEDFileFieldPerMeshPerTypePerDisc::simpleRepr(int bkOffset, std::ostream& oss, int id) const
+{
+ const char startLine[]=" ## ";
+ std::string startLine2(bkOffset,' ');
+ startLine2+=startLine;
+ MEDCouplingFieldDiscretization *tmp=MEDCouplingFieldDiscretization::New(_type);
+ oss << startLine2 << "Localization #" << id << "." << std::endl;
+ oss << startLine2 << " Type=" << tmp->getRepr() << "." << std::endl;
+ delete tmp;
+ oss << startLine2 << " This type discretization lies on profile : \"" << _profile << "\" and on the following localization : \"" << _localization << "\"." << std::endl;
+ oss << startLine2 << " This type discretization has " << _end-_start << " tuples (start=" << _start << ", end=" << _end << ")." << std::endl;
+ oss << startLine2 << " This type discretization has " << (_end-_start)/_nval << " integration points." << std::endl;
+}
+
TypeOfField MEDFileFieldPerMeshPerTypePerDisc::getType() const
{
return _type;
return _father->getMeshName();
}
+void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int id) const
+{
+ const char startLine[]=" ## ";
+ std::string startLine2(bkOffset,' ');
+ std::string startLine3(startLine2);
+ startLine3+=startLine;
+ if(_geo_type!=INTERP_KERNEL::NORM_ERROR)
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ oss << startLine3 << "Entry geometry type #" << id << " is lying on geometry types " << cm.getRepr() << "." << std::endl;
+ }
+ else
+ oss << startLine3 << "Entry geometry type #" << id << " is lying on NODES." << std::endl;
+ oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl;
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ {
+ const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it);
+ if(cur)
+ cur->simpleRepr(bkOffset,oss,i);
+ else
+ {
+ oss << startLine2 << " ## " << "Localization #" << i << " is empty !" << std::endl;
+ }
+ }
+}
+
void MEDFileFieldPerMeshPerType::getSizes(int& globalSz, int& nbOfEntries) const
{
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
return new MEDFileFieldPerMesh(fath,mesh);
}
+void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) const
+{
+ std::string startLine(bkOffset,' ');
+ oss << startLine << "## Field part (" << id << ") lying on mesh \"" << _mesh_name << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl;
+ oss << startLine << "## Field is defined on " << _field_pm_pt.size() << " types." << std::endl;
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
+ {
+ const MEDFileFieldPerMeshPerType *cur=*it;
+ if(cur)
+ cur->simpleRepr(bkOffset,oss,i);
+ else
+ {
+ oss << startLine << " ## Entry geometry type #" << i << " is empty !" << std::endl;
+ }
+ }
+}
+
void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
{
_mesh_name=mesh->getName();
return arr->getName();
}
+void MEDFileField1TSWithoutDAS::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
+{
+ std::string startOfLine(bkOffset,' ');
+ oss << startOfLine << "Field on One time Step ";
+ if(f1tsId>=0)
+ oss << "(" << f1tsId << ") ";
+ oss << "on iteration=" << _iteration << " order=" << _order << "." << std::endl;
+ oss << startOfLine << "Time attached is : " << _dt << " [" << _dt_unit << "]." << std::endl;
+ const DataArrayDouble *arr=_arr;
+ if(arr)
+ {
+ const std::vector<std::string> &comps=arr->getInfoOnComponents();
+ if(f1tsId<0)
+ {
+ oss << startOfLine << "Field Name : \"" << arr->getName() << "\"." << std::endl;
+ oss << startOfLine << "Field has " << comps.size() << " components with the following infos :" << std::endl;
+ for(std::vector<std::string>::const_iterator it=comps.begin();it!=comps.end();it++)
+ oss << startOfLine << " - \"" << (*it) << "\"" << std::endl;
+ }
+ if(arr->isAllocated())
+ {
+ oss << startOfLine << "Whole field contains " << arr->getNumberOfTuples() << " tuples." << std::endl;
+ }
+ else
+ oss << startOfLine << "The array of the current field has not allocated yet !" << std::endl;
+ }
+ else
+ {
+ oss << startOfLine << "Field infos are empty ! Not defined yet !" << std::endl;
+ }
+ oss << startOfLine << "----------------------" << std::endl;
+ if(!_field_per_mesh.empty())
+ {
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++)
+ {
+ const MEDFileFieldPerMesh *cur=(*it2);
+ if(cur)
+ cur->simpleRepr(bkOffset,oss,i);
+ else
+ oss << startOfLine << "Field per mesh #" << i << " is not defined !" << std::endl;
+ }
+ }
+ else
+ {
+ oss << startOfLine << "Field is not defined on any meshes !" << std::endl;
+ }
+ oss << startOfLine << "----------------------" << std::endl;
+}
+
std::string MEDFileField1TSWithoutDAS::getMeshName() const throw(INTERP_KERNEL::Exception)
{
if(_field_per_mesh.empty())
return iteration==_iteration && order==_order;
}
-void MEDFileField1TSWithoutDAS::simpleReprWithoutHeader(std::ostream& oss) const
-{
- oss << "Iteration=" << _iteration << " Order=" << _order << " Time=" << _dt << " Time Unit=\"" << _dt_unit << "\"";
-}
-
std::pair<int,int> MEDFileField1TSWithoutDAS::getDtIt() const
{
std::pair<int,int> p;
return new MEDFileField1TS;
}
+std::string MEDFileField1TS::simpleRepr() const
+{
+ std::ostringstream oss;
+ MEDFileField1TSWithoutDAS::simpleRepr(0,oss,-1);
+ MEDFieldFieldGlobsReal::simpleRepr(oss);
+ return oss.str();
+}
+
void MEDFileField1TS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
{
int nbComp=getNumberOfComponents();
return _name;
}
+void MEDFileFieldMultiTSWithoutDAS::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
+{
+ std::string startLine(bkOffset,' ');
+ oss << startLine << "Field multi time steps";
+ if(fmtsId>=0)
+ oss << " (" << fmtsId << ")";
+ oss << " has the following name: \"" << _name << "\"." << std::endl;
+ oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl;
+ for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+ {
+ oss << startLine << " - \"" << *it << "\"" << std::endl;
+ }
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ {
+ std::string chapter(17,'0'+i);
+ oss << startLine << chapter << std::endl;
+ const MEDFileField1TSWithoutDAS *cur=(*it);
+ if(cur)
+ cur->simpleRepr(bkOffset+2,oss,i);
+ else
+ oss << startLine << " Field on one time step #" << i << " is not defined !" << std::endl;
+ oss << startLine << chapter << std::endl;
+ }
+}
+
std::vector< std::pair<int,int> > MEDFileFieldMultiTSWithoutDAS::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
{
std::size_t sz=_time_steps.size();
std::string MEDFileFieldMultiTS::simpleRepr() const
{
std::ostringstream oss;
- oss << "(***********************)\n" << "(* MEDFileFieldMultiTS *)\n" << "(***********************)\n";
- oss << "Field with name \"" << _name << "\"\n\n";
- oss << "Infos attached : \n";
- std::size_t nis=_infos.size();
- for(std::size_t i=0;i<nis;i++)
- oss << " - " << _infos[i] << std::endl;
- nis=_time_steps.size();
- oss << std::endl << "There are " << nis << " time steps on this field :\n";
- for(std::size_t i=0;i<nis;i++)
- {
- const MEDFileField1TSWithoutDAS *ftmp=_time_steps[i];
- oss << " - #" << i << " ";
- if(ftmp)
- {
- ftmp->simpleReprWithoutHeader(oss);
- oss << "\n\n";
- }
- else
- {
- oss << "NOT DEFINED !!!\n\n";
- }
- }
+ MEDFileFieldMultiTSWithoutDAS::simpleRepr(0,oss,-1);
MEDFieldFieldGlobsReal::simpleRepr(oss);
return oss.str();
}
{
std::ostringstream oss;
oss << "(*****************)\n(* MEDFileFields *)\n(*****************)\n\n";
- simpleReprWithoutHeader(oss);
- MEDFieldFieldGlobsReal::simpleRepr(oss);
+ simpleRepr(0,oss);
return oss.str();
}
-void MEDFileFields::simpleReprWithoutHeader(std::ostream& oss) const
+void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const
{
int nbOfFields=getNumberOfFields();
- oss << "There are " << nbOfFields << " fields with the following names : \n";
- std::vector<std::string> fns=getFieldsNames();
- for(int i=0;i<nbOfFields;i++)
- oss << " - #" << i << " \"" << fns[i] << "\"\n";
+ std::string startLine(bkOffset,' ');
+ oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl;
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutDAS> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ {
+ const MEDFileFieldMultiTSWithoutDAS *cur=(*it);
+ if(cur)
+ {
+ oss << startLine << " - # "<< i << " has the following name : \"" << cur->getName() << "\"." << std::endl;
+ }
+ else
+ {
+ oss << startLine << " - not defined !" << std::endl;
+ }
+ }
+ i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutDAS> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ {
+ const MEDFileFieldMultiTSWithoutDAS *cur=(*it);
+ std::string chapter(17,'0'+i);
+ oss << startLine << chapter << std::endl;
+ if(cur)
+ {
+ cur->simpleRepr(bkOffset+2,oss,i);
+ }
+ else
+ {
+ oss << startLine << " - not defined !" << std::endl;
+ }
+ oss << startLine << chapter << std::endl;
+ }
+ MEDFieldFieldGlobsReal::simpleRepr(oss);
}
MEDFileFields::MEDFileFields()
void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
void assignFieldProfile(int& start, const char *pflName, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
- //void assignNodeFieldProfile(int& start, const char *pflName, const DataArrayInt *idsInPfl, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception); tony
void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const throw(INTERP_KERNEL::Exception);
void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
const MEDFileFieldPerMeshPerType *getFather() const;
std::string getName() const;
std::string getMeshName() const;
TypeOfField getType() const;
+ void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
void setType(TypeOfField newType);
INTERP_KERNEL::NormalizedCellType getGeoType() const;
double getTime() const;
std::string getName() const;
std::string getMeshName() const;
+ void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
void getSizes(int& globalSz, int& nbOfEntries) const;
INTERP_KERNEL::NormalizedCellType getGeoType() const;
int getNumberOfComponents() const;
public:
static MEDFileFieldPerMesh *New(MEDFileField1TSWithoutDAS *fath, const MEDCouplingMesh *mesh);
static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileField1TSWithoutDAS *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception);
+ void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
void copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
void assignFieldProfileGeneral(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; }
void setTime(double val, int iteration, int order) { _dt=val; _iteration=iteration; _order=order; }
std::string getName() const;
+ void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
const std::string& getDtUnit() const { return _dt_unit; }
std::string getMeshName() const throw(INTERP_KERNEL::Exception);
int getMeshIteration() const throw(INTERP_KERNEL::Exception);
public:
static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
static MEDFileField1TS *New();
+ std::string simpleRepr() const;
void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
virtual void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
std::string getName() const;
+ void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
std::string getMeshName() const throw(INTERP_KERNEL::Exception);
const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
int getNumberOfFields() const;
std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const;
- void simpleReprWithoutHeader(std::ostream& oss) const;
+ void simpleRepr(int bkOffset, std::ostream& oss) const;
//
void resize(int newSize) throw(INTERP_KERNEL::Exception);
void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);