ExtractGroupStatus():_status(false) { }
ExtractGroupStatus(const char *name);
bool getStatus() const { return _status; }
- void setStatus(bool status) { _status=status; }
+ void setStatus(bool status) const { _status=status; }
void cpyStatusFrom(const ExtractGroupStatus& other) { _status=other._status; }
std::string getName() const { return _name; }
+ void resetStatus() const { _status=false; }
const char *getKeyOfEntry() const { return _ze_key_name.c_str(); }
virtual void printMySelf(std::ostream& os) const;
virtual bool isSameAs(const ExtractGroupStatus& other) const;
protected:
-bool _status;
+mutable bool _status;
std::string _name;
std::string _ze_key_name;
};
void setStatusOfEntryStr(const char *entry, bool status);
void printMySelf(std::ostream& os) const;
std::set<int> getIdsToKeep() const;
+ void clearSelection() const;
int getIdOfFamily(const std::string& famName) const;
static bool IsInformationOK(vtkInformation *info);
private:
private:
std::vector<ExtractGroupGrp> _groups;
std::vector<ExtractGroupFam> _fams;
+ mutable std::vector< std::pair<std::string,bool> > _selection;
std::string _mesh_name;
};
void vtkExtractGroup::vtkExtractGroupInternal::setStatusOfEntryStr(const char *entry, bool status)
{
- ExtractGroupStatus& elt(getEntry(entry));
- elt.setStatus(status);
+ _selection.emplace_back(entry,status);
}
const ExtractGroupStatus& vtkExtractGroup::vtkExtractGroupInternal::getEntry(const char *entry) const
std::set<int> vtkExtractGroup::vtkExtractGroupInternal::getIdsToKeep() const
{
+ for(auto it: _selection)
+ {
+ const ExtractGroupStatus& elt(getEntry(it.first.c_str()));
+ elt.setStatus(it.second);
+ }
std::map<std::string,int> m(this->computeFamStrIdMap());
std::set<int> s;
for(std::vector<ExtractGroupGrp>::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
return s;
}
+void vtkExtractGroup::vtkExtractGroupInternal::clearSelection() const
+{
+ _selection.clear();
+ for(auto it : _groups)
+ it.resetStatus();
+ for(auto it : _fams)
+ it.resetStatus();
+}
+
std::map<std::string,int> vtkExtractGroup::vtkExtractGroupInternal::computeFamStrIdMap() const
{
std::map<std::string,int> ret;
vtkInformation *outInfo(outputVector->GetInformationObject(0));
vtkMultiBlockDataSet *output(vtkMultiBlockDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())));
std::set<int> idsToKeep(this->Internal->getIdsToKeep());
+ this->Internal->clearSelection();
// first shrink the input
bool catchAll,catchSmth;
vtkSmartPointer<vtkThreshold> thres1(vtkSmartPointer<vtkThreshold>::New()),thres2(vtkSmartPointer<vtkThreshold>::New());
void vtkExtractGroup::SetGroupsFlagsStatus(const char *name, int status)
{
//std::cerr << "vtkExtractGroup::SetFieldsStatus(" << name << "," << status << ")" << std::endl;
- if (GetNumberOfGroupsFlagsArrays()<1)
- return;
this->Internal->setStatusOfEntryStr(name,(bool)status);
- if(std::string(name)==GetGroupsFlagsArrayName(GetNumberOfGroupsFlagsArrays()-1))
- this->Modified();
+ this->Modified();
//this->Internal->printMySelf(std::cerr);
}
RenderView1 = GetRenderView()
ELNOfieldToSurface1=ELNOfieldToSurface(Input=myMedReader)
ExtractGroup1=ExtractGroup(Input=ELNOfieldToSurface1)
-ExtractGroup1.UpdatePipelineInformation()
+#ExtractGroup1.UpdatePipelineInformation()
ExtractGroup1.AllGroups=['GRP_ba2','GRP_to1','GRP_web']
assert(isinstance(ExtractGroup1.GetProperty("MeshName")[0],str))
assert(ExtractGroup1.GetProperty("MeshName")[0]=="mesh")
assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE']
ExtractGroup1 = ExtractGroup(Input=reader)
-ExtractGroup1.UpdatePipelineInformation()
+#ExtractGroup1.UpdatePipelineInformation()
ExtractGroup1.AllGroups=["GRP_grp1"]
ELNOfieldToSurface1=ELNOfieldToSurface(Input=ExtractGroup1)
ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=ExtractGroup1)
assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE']
ExtractGroup1 = ExtractGroup(Input=reader)
-ExtractGroup1.UpdatePipelineInformation()
+#ExtractGroup1.UpdatePipelineInformation()
ExtractGroup1.AllGroups=["GRP_grp1"]
ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=ExtractGroup1)
ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField']
ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=reader)
ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField']
ExtractGroup1 = ExtractGroup(Input=ELNOfieldToPointGaussian1)
-ExtractGroup1.UpdatePipelineInformation()
+#ExtractGroup1.UpdatePipelineInformation()
ExtractGroup1.AllGroups=["GRP_grp1"]
-ExtractGroup1.UpdatePipeline()
+#ExtractGroup1.UpdatePipeline()
res=servermanager.Fetch(ExtractGroup1,0)
assert(res.GetBlock(0).GetNumberOfCells()==8)
vtkArrToTest=res.GetBlock(0).GetPointData().GetArray("MyField")
reader.AllArrays=['TS0/mesh/ComSup0/mesh@@][@@P0']
ExtractGroup1 = ExtractGroup(Input=reader)
ExtractGroup1.AllGroups=["GRP_grp0","GRP_grp1"]
-ExtractGroup1.UpdatePipelineInformation()
+#ExtractGroup1.UpdatePipelineInformation()
res=servermanager.Fetch(ExtractGroup1,0)
assert(res.GetNumberOfBlocks()==2)
assert(res.GetBlock(1).GetNumberOfCells()==1)
extractCT.AllGeoTypes=['TRI3']
extGrp=ExtractGroup(Input=extractCT)
-extGrp.UpdatePipelineInformation()
+#extGrp.UpdatePipelineInformation()
assert([x for x in list(extGrp.GetProperty("GroupsFlagsInfo")[::2]) if x[:4]=="GRP_"]==['GRP_grp0'])
extGrp.AllGroups="GRP_grp0"
myMedReader=MEDReader(FileName=fname)
myMedReader.AllArrays=['TS0/m1/ComSup0/f1@@][@@P0']
-myMedReader.UpdatePipelineInformation()
+#myMedReader.UpdatePipelineInformation()
ExtractGroup1=ExtractGroup(Input=myMedReader)
-ExtractGroup1.UpdatePipelineInformation()
+#ExtractGroup1.UpdatePipelineInformation()
assert(ExtractGroup1.GetProperty("MeshName")[0]=="m1")
myMedReader.AllArrays=['TS0/m2/ComSup0/f2@@][@@P0']
-myMedReader.UpdatePipeline()
+#myMedReader.UpdatePipeline()
ExtractGroup2=ExtractGroup(Input=myMedReader)
-ExtractGroup2.UpdatePipelineInformation()
+#ExtractGroup2.UpdatePipelineInformation()
assert(ExtractGroup2.GetProperty("MeshName")[0]=="m2")