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);
}