// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
for(int i=0;i<nbGaussPt;i++)
{
const double *pt0(calculator.getFunctionValues(i));
- std::copy(pt0,pt0+nbPtsPerCell,shape+nbPtsPerCell*i);
+ if(ct!=INTERP_KERNEL::NORM_HEXA27)
+ std::copy(pt0,pt0+nbPtsPerCell,shape+nbPtsPerCell*i);
+ else
+ {
+ for(int j=0;j<27;j++)
+ shape[nbPtsPerCell*i+j]=pt0[MEDMeshMultiLev::HEXA27_PERM_ARRAY[j]];
+ }
}
unsigned char vtkType(MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE[ct]);
m[vtkType]=nbGaussPt;
return _arrays[0]->getNumberOfTS();
}
-void MEDFileFieldRepresentationLeaves::feedSIL(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, const std::string& tsName, const std::string& meshName, const std::string& comSupStr, std::vector<std::string>& names) const
+/*!
+ * \param [in] ms is the meshes pointer. It can be used only for information of geometric types. No special processing will be requested on ms.
+ */
+void MEDFileFieldRepresentationLeaves::feedSIL(const ParaMEDMEM::MEDFileMeshes *ms, vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, const std::string& tsName, const std::string& meshName, const std::string& comSupStr, std::vector<std::string>& names) const
{
+ vtkIdType root2(sil->AddChild(root,edge));
+ names.push_back(std::string("Arrs"));
for(std::vector<MEDFileFieldRepresentationLeavesArrays>::const_iterator it=_arrays.begin();it!=_arrays.end();it++)
- (*it).feedSIL(sil,root,edge,tsName,meshName,comSupStr,names);
+ (*it).feedSIL(sil,root2,edge,tsName,meshName,comSupStr,names);
+ //
+ vtkIdType root3(sil->AddChild(root,edge));
+ names.push_back(std::string("InfoOnGeoType"));
+ const ParaMEDMEM::MEDFileMesh *m(0);
+ if(ms)
+ m=ms->getMeshWithName(meshName);
+ const ParaMEDMEM::MEDFileFastCellSupportComparator *fsp(_fsp);
+ if(!fsp || fsp->getNumberOfTS()==0)
+ return ;
+ std::vector< INTERP_KERNEL::NormalizedCellType > gts(fsp->getGeoTypesAt(0,m));
+ for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it2=gts.begin();it2!=gts.end();it2++)
+ {
+ const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it2));
+ std::string cmStr(cm.getRepr()); cmStr=cmStr.substr(5);//skip "NORM_"
+ sil->AddChild(root3,edge);
+ names.push_back(cmStr);
+ }
}
bool MEDFileFieldRepresentationLeaves::containId(int id) const
std::string comSupStr(oss2.str());
vtkIdType typeId2(sil->AddChild(typeId1,edge));
names.push_back(comSupStr);
- (*it2).feedSIL(sil,typeId2,edge,tsName,meshName,comSupStr,names);
+ (*it2).feedSIL(_ms,sil,typeId2,edge,tsName,meshName,comSupStr,names);
}
}
}
{
AppendFieldFromMeshes(_ms,_fields);
}
+ _fields->removeFieldsWithoutAnyTimeStep();
std::vector<std::string> meshNames(_ms->getMeshesNames());
std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFields> > fields_per_mesh(meshNames.size());
for(std::size_t i=0;i<meshNames.size();i++)
for(int i=0;i<ms->getNumberOfMeshes();i++)
{
MEDFileMesh *mm(ms->getMeshAtPos(i));
- MEDFileUMesh *mmu(dynamic_cast<MEDFileUMesh *>(mm));
- if(!mmu)
- continue;
std::vector<int> levs(mm->getNonEmptyLevels());
ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDFileField1TS> f1tsMultiLev(ParaMEDMEM::MEDFileField1TS::New());
- for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
- {
- std::vector<INTERP_KERNEL::NormalizedCellType> gts(mmu->getGeoTypesAtLevel(*it));
- for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator gt=gts.begin();gt!=gts.end();gt++)
- {
- ParaMEDMEM::MEDCouplingMesh *m(mmu->getDirectUndergroundSingleGeoTypeMesh(*gt));
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f(ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS));
- f->setMesh(m);
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> arr(ParaMEDMEM::DataArrayDouble::New()); arr->alloc(f->getNumberOfTuplesExpected());
- arr->setInfoOnComponent(0,std::string(COMPO_STR_TO_LOCATE_MESH_DA));
- arr->iota();
- f->setArray(arr);
- f->setName(mm->getName());
- f1tsMultiLev->setFieldNoProfileSBT(f);
- }
- }
- if(levs.empty())
- {
- std::vector<int> levsExt(mm->getNonEmptyLevelsExt());
- if(levsExt.size()==levs.size()+1)
- {
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingMesh> m(mm->getGenMeshAtLevel(1));
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f(ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_NODES));
- f->setMesh(m);
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> arr(ParaMEDMEM::DataArrayDouble::New()); arr->alloc(m->getNumberOfNodes());
- arr->setInfoOnComponent(0,std::string(COMPO_STR_TO_LOCATE_MESH_DA));
- arr->iota(); f->setArray(arr);
- f->setName(mm->getName());
- f1tsMultiLev->setFieldNoProfileSBT(f);
- }
- else
- continue;
- }
+ MEDFileUMesh *mmu(dynamic_cast<MEDFileUMesh *>(mm));
+ if(mmu)
+ {
+ for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
+ {
+ std::vector<INTERP_KERNEL::NormalizedCellType> gts(mmu->getGeoTypesAtLevel(*it));
+ for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator gt=gts.begin();gt!=gts.end();gt++)
+ {
+ ParaMEDMEM::MEDCouplingMesh *m(mmu->getDirectUndergroundSingleGeoTypeMesh(*gt));
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f(ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS));
+ f->setMesh(m);
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> arr(ParaMEDMEM::DataArrayDouble::New()); arr->alloc(f->getNumberOfTuplesExpected());
+ arr->setInfoOnComponent(0,std::string(COMPO_STR_TO_LOCATE_MESH_DA));
+ arr->iota();
+ f->setArray(arr);
+ f->setName(mm->getName());
+ f1tsMultiLev->setFieldNoProfileSBT(f);
+ }
+ }
+ if(levs.empty())
+ {
+ std::vector<int> levsExt(mm->getNonEmptyLevelsExt());
+ if(levsExt.size()==levs.size()+1)
+ {
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingMesh> m(mm->getGenMeshAtLevel(1));
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f(ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_NODES));
+ f->setMesh(m);
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> arr(ParaMEDMEM::DataArrayDouble::New()); arr->alloc(m->getNumberOfNodes());
+ arr->setInfoOnComponent(0,std::string(COMPO_STR_TO_LOCATE_MESH_DA));
+ arr->iota(); f->setArray(arr);
+ f->setName(mm->getName());
+ f1tsMultiLev->setFieldNoProfileSBT(f);
+ }
+ else
+ continue;
+ }
+ }
+ else
+ {
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingMesh> m(mm->getGenMeshAtLevel(0));
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f(ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS));
+ f->setMesh(m);
+ ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> arr(ParaMEDMEM::DataArrayDouble::New()); arr->alloc(f->getNumberOfTuplesExpected());
+ arr->setInfoOnComponent(0,std::string(COMPO_STR_TO_LOCATE_MESH_DA));
+ arr->iota();
+ f->setArray(arr);
+ f->setName(mm->getName());
+ f1tsMultiLev->setFieldNoProfileSBT(f);
+ }
//
ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDFileFieldMultiTS> fmtsMultiLev(ParaMEDMEM::MEDFileFieldMultiTS::New());
fmtsMultiLev->pushBackTimeStep(f1tsMultiLev);