const char MEDFileFieldRepresentationTree::COMPO_STR_TO_LOCATE_MESH_DA[]="-@?|*_";
-vtkIdTypeArray *ELGACmp::findOrCreate(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds, bool& isNew) const
+vtkIdTypeArray *ELGACmp::findOrCreate(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds, bool& isNew, ExportedTinyInfo *internalInfo) const
{
vtkIdTypeArray *try0(isExisting(locsReallyUsed,vtkd));
if(try0)
else
{
isNew=true;
- return createNew(globs,locsReallyUsed,vtkd,ds);
+ return createNew(globs,locsReallyUsed,vtkd,ds,internalInfo);
}
}
return ret;
}
-vtkIdTypeArray *ELGACmp::createNew(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds) const
+vtkIdTypeArray *ELGACmp::createNew(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const
{
const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
std::vector< std::vector<std::string> > locNames(_loc_names);
vtkQuadratureSchemeDefinition *def(vtkQuadratureSchemeDefinition::New());
const MEDFileFieldLoc& loc(globs->getLocalization((*it).c_str()));
INTERP_KERNEL::NormalizedCellType ct(loc.getGeoType());
+ unsigned char vtkType(MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE[ct]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(ct));
int nbGaussPt(loc.getNbOfGaussPtPerCell()),nbPtsPerCell((int)cm.getNumberOfNodes()),dimLoc(loc.getDimension());
// WARNING : these 2 lines are a workaround, due to users that write a ref element with dimension not equal to dimension of the geometric element.
std::vector<double> gsCoods2(INTERP_KERNEL::GaussInfo::NormalizeCoordinatesIfNecessary(ct,dimLoc,loc.getGaussCoords()));
std::vector<double> refCoods2(INTERP_KERNEL::GaussInfo::NormalizeCoordinatesIfNecessary(ct,dimLoc,loc.getRefCoords()));
+ if(internalInfo)
+ internalInfo->pushGaussAdditionnalInfo(vtkType,dimLoc,gsCoods2,refCoods2);
double *shape(new double[nbPtsPerCell*nbGaussPt]);
INTERP_KERNEL::GaussInfo calculator(ct,gsCoods2,nbGaussPt,refCoods2,nbPtsPerCell);
calculator.initLocalInfo();
shape[nbPtsPerCell*i+j]=pt0[MEDMeshMultiLev::HEXA27_PERM_ARRAY[j]];
}
}
- unsigned char vtkType(MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE[ct]);
m[vtkType]=nbGaussPt;
def->Initialize(vtkType,nbPtsPerCell,nbGaussPt,shape,const_cast<double *>(&wgths[0]));
delete [] shape;
return ret;
}
-void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshStruct *mst, vtkDataSet *ds) const
+void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshStruct *mst, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const
{
const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
tr->setNumberOfTS((operator->())->getNumberOfTS());
if(discs[0]==ON_GAUSS_PT)
{
bool tmp;
- _elga_cmp.findOrCreate(globs,f1ts->getLocsReallyUsed(),vtkd,ds,tmp);
+ _elga_cmp.findOrCreate(globs,f1ts->getLocsReallyUsed(),vtkd,ds,tmp,internalInfo);
}
if(discs[0]==ON_GAUSS_NE)
{
return oss.str();
}
-void MEDFileFieldRepresentationLeaves::appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshes *meshes, vtkDataSet *ds) const
+void MEDFileFieldRepresentationLeaves::appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshes *meshes, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const
{
if(_arrays.size()<1)
throw INTERP_KERNEL::Exception("MEDFileFieldRepresentationLeaves::appendFields : internal error !");
for(std::vector<MEDFileFieldRepresentationLeavesArrays>::const_iterator it=_arrays.begin();it!=_arrays.end();it++)
if((*it).getStatus())
{
- (*it).appendFields(tr,globs,mml,mst,ds);
+ (*it).appendFields(tr,globs,mml,mst,ds,internalInfo);
(*it).appendELGAIfAny(ds);
}
}
return ret;
}
-vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes) const
+vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes, ExportedTinyInfo *internalInfo) const
{
vtkDataSet *ret(0);
//_fsp->isDataSetSupportEqualToThePreviousOne(i,globs);
ret->ShallowCopy(_cached_ds);
}
//
- appendFields(tr,globs,mml,meshes,ret);
+ appendFields(tr,globs,mml,meshes,ret,internalInfo);
// The arrays links to mesh
DataArrayInt *famCells(0),*numCells(0);
bool noCpyFamCells(false),noCpyNumCells(false);
return leaf.getTimeSteps(tk);
}
-vtkDataSet *MEDFileFieldRepresentationTree::buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk) const
+vtkDataSet *MEDFileFieldRepresentationTree::buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk, ExportedTinyInfo *internalInfo) const
{
int lev0,lev1,lev2;
const MEDFileFieldRepresentationLeaves& leaf(getTheSingleActivated(lev0,lev1,lev2));
tr=new MEDStdTimeReq((int)zeTimeId);
else
tr=new MEDModeTimeReq(tk.getTheVectOfBool(),tk.getPostProcessedTime());
- vtkDataSet *ret(leaf.buildVTKInstanceNoTimeInterpolation(tr,_fields,_ms));
+ vtkDataSet *ret(leaf.buildVTKInstanceNoTimeInterpolation(tr,_fields,_ms,internalInfo));
delete tr;
return ret;
}
class TimeKeeper;
class MEDTimeReq;
+class ExportedTinyInfo;
class ELGACmp
{
public:
- vtkIdTypeArray *findOrCreate(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds, bool& isNew) const;
+ vtkIdTypeArray *findOrCreate(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds, bool& isNew, ExportedTinyInfo *internalInfo) const;
void appendELGAIfAny(vtkDataSet *ds) const;
~ELGACmp();
private:
vtkIdTypeArray *isExisting(const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd) const;
- vtkIdTypeArray *createNew(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds) const;
+ vtkIdTypeArray *createNew(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const;
private:
//! size of _loc_names is equal to _elgas.
mutable std::vector< std::vector<std::string> > _loc_names;
bool setStatus(bool status) const;
std::string getZeName() const;
const char *getZeNameC() const;
- void appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshStruct *mst, vtkDataSet *ds) const;
+ void appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshStruct *mst, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const;
void appendELGAIfAny(vtkDataSet *ds) const;
public:
static const char ZE_SEP[];
std::vector<double> getTimeSteps(const TimeKeeper& tk) const;
std::vector< std::pair<int,int> > getTimeStepsInCoarseMEDFileFormat(std::vector<double>& ts) const;
std::string getHumanReadableOverviewOfTS() const;
- vtkDataSet *buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes) const;
+ vtkDataSet *buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes, ExportedTinyInfo *internalInfo=0) const;
private:
vtkUnstructuredGrid *buildVTKInstanceNoTimeInterpolationUnstructured(MEDCoupling::MEDUMeshMultiLev *mm) const;
vtkRectilinearGrid *buildVTKInstanceNoTimeInterpolationCartesian(MEDCoupling::MEDCMeshMultiLev *mm) const;
vtkStructuredGrid *buildVTKInstanceNoTimeInterpolationCurveLinear(MEDCoupling::MEDCurveLinearMeshMultiLev *mm) const;
- void appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshes *meshes, vtkDataSet *ds) const;
+ void appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshes *meshes, vtkDataSet *ds, ExportedTinyInfo *internalInfo=0) const;
private:
std::vector<MEDFileFieldRepresentationLeavesArrays> _arrays;
MEDCoupling::MCAuto<MEDCoupling::MEDFileFastCellSupportComparator> _fsp;
//
std::string getDftMeshName() const;
std::vector<double> getTimeSteps(int& lev0, const TimeKeeper& tk) const;
- vtkDataSet *buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk) const;
+ vtkDataSet *buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk, ExportedTinyInfo *internalInfo=0) const;
void printMySelf(std::ostream& os) const;
std::map<std::string,bool> dumpState() const;
//non const methods
#include "vtkInformationIntegerKey.h"
#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
+#include <algorithm>
+
vtkInformationKeyMacro(MEDUtilities,ELGA,Integer);
vtkInformationKeyMacro(MEDUtilities,ELNO,Integer);
+
+void ExportedTinyInfo::pushGaussAdditionnalInfo(int ct, int dim, const std::vector<double>& refCoo, const std::vector<double>& posInRefCoo)
+{
+ prepareForAppend();
+ std::vector<double> tmp(1,(double)ct);
+ tmp.push_back((double)dim);
+ tmp.insert(tmp.end(),refCoo.begin(),refCoo.end());
+ tmp.insert(tmp.end(),posInRefCoo.begin(),posInRefCoo.end());
+ _data.push_back((double)tmp.size());
+ _data.insert(_data.end(),tmp.begin(),tmp.end());
+}
+
+void ExportedTinyInfo::prepareForAppend()
+{
+ if(_data.empty())
+ _data.push_back(1.);
+ else
+ {
+ double val(_data[0]);
+ int val2((int) val);
+ _data[0]=++val2;
+ }
+}
#define __MEDUTILITIES_HXX__
#include "MEDLoaderForPV.h"
+#include "vtkCellType.h"
+
+#include <vector>
class vtkInformationIntegerKey;
static vtkInformationIntegerKey *ELNO();
};
+class ExportedTinyInfo
+{
+public:
+ void pushGaussAdditionnalInfo(int ct, int dim, const std::vector<double>& refCoo, const std::vector<double>& posInRefCoo);
+ const std::vector<double>& getData() const { return _data; }
+ bool empty() const { return _data.empty(); }
+private:
+ void prepareForAppend();
+private:
+ // first place is nb of ct
+ // 2nd place is the size of first ct def (this 2nd place included)
+ // 3rd place is the VTK cell type of first ct def
+ // 4th place is the dimension of first ct def
+ // 5th->n th : ref Coo
+ // nth -> n+p th : posInRefCoo
+ // n+p+1 -> size of second ct def (this n+p+1 place included)
+ // n+p+2 -> VTK cell type of second ct def
+ // ...
+ std::vector<double> _data;
+};
+
#endif
#include "vtkMEDReader.h"
#include "vtkGenerateVectors.h"
+#include "MEDUtilities.hxx"
#include "vtkMultiBlockDataSet.h"
#include "vtkInformation.h"
#include "vtkMultiTimeStepAlgorithm.h"
#include "vtkUnstructuredGrid.h"
#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
+#include "vtkInformationDoubleVectorKey.h"
#include "vtkQuadratureSchemeDefinition.h"
#include "vtkPointData.h"
#include "vtkCellData.h"
}
return ret;
}
+
+static vtkInformationDoubleVectorKey *vtkMEDReader_GAUSS_DATA=new vtkInformationDoubleVectorKey("GAUSS_DATA","vtkMEDReader");
+
+vtkInformationDoubleVectorKey *vtkMEDReader::GAUSS_DATA()
+{
+ static const char ZE_KEY[]="vtkMEDReader::GAUSS_DATA";
+ vtkInformationDoubleVectorKey *ret(vtkMEDReader_GAUSS_DATA);
+ MEDCoupling::GlobalDict *gd(MEDCoupling::GlobalDict::GetInstance());
+ if(!gd->hasKey(ZE_KEY))
+ {// here META_DATA is put on global var to be exchanged with other filters without dependancy of MEDReader. Please do not change ZE_KEY !
+ std::ostringstream oss; oss << ret;
+ gd->setKeyValue(ZE_KEY,oss.str());
+ }
+ return ret;
+}
// end of overload of vtkInformationKeyMacro
vtkMEDReader::vtkMEDReader():Internal(new vtkMEDReaderInternal(this))
if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
reqTS=outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
#ifndef MEDREADER_USE_MPI
- this->FillMultiBlockDataSetInstance(output,reqTS);
+ ExportedTinyInfo ti;
+ this->FillMultiBlockDataSetInstance(output,reqTS,&ti);
+ if(!ti.empty())
+ {
+ const std::vector<double>& data(ti.getData());
+ outInfo->Set(vtkMEDReader::GAUSS_DATA(),&data[0],data.size());
+ request->Append(vtkExecutive::KEYS_TO_COPY(),vtkMEDReader::GAUSS_DATA());// Thank you to SciberQuest and DIPOLE_CENTER ! Don't understand why ! In RequestInformation it does not work !
+ }
#else
if(this->Internal->GCGCP)
{
return tsteps.front();
}
-void vtkMEDReader::FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS)
+void vtkMEDReader::FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS, ExportedTinyInfo *internalInfo)
{
if( !this->Internal )
return;
- vtkDataSet *ret(RetrieveDataSetAtTime(reqTS));
+ vtkDataSet *ret(RetrieveDataSetAtTime(reqTS,internalInfo));
output->SetBlock(0,ret);
ret->Delete();
}
-vtkDataSet *vtkMEDReader::RetrieveDataSetAtTime(double reqTS)
+vtkDataSet *vtkMEDReader::RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo *internalInfo)
{
if( !this->Internal )
return 0;
std::string meshName;
- vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->Internal->IsStdOrMode,reqTS,meshName,this->Internal->TK));
+ vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->Internal->IsStdOrMode,reqTS,meshName,this->Internal->TK,internalInfo));
if(this->Internal->GenerateVect)
{
vtkGenerateVectors::Operate(ret->GetPointData());
class vtkDataSet;
class vtkMutableDirectedGraph;
class vtkInformationDataObjectMetaDataKey;
+class vtkInformationDoubleVectorKey;
+class ExportedTinyInfo;
class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
{
// Description
// Static information key used to transfer the meta data graph along the pipeline
static vtkInformationDataObjectMetaDataKey* META_DATA();
+ static vtkInformationDoubleVectorKey* GAUSS_DATA();
protected:
vtkMEDReader();
private:
void UpdateSIL(vtkInformation *request, vtkInformation *info);
virtual double PublishTimeStepsIfNeeded(vtkInformation*, bool& isUpdated);
- virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS);
- vtkDataSet *RetrieveDataSetAtTime(double reqTS);
+ virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS, ExportedTinyInfo *internalInfo=0);
+ vtkDataSet *RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo *internalInfo);
private:
//BTX
//ETX