FEM Post: Clean up work

This commit is contained in:
Stefan Tröger
2016-01-01 20:19:55 +01:00
committed by wmayer
parent 336e014130
commit e801be0ccd
6 changed files with 51 additions and 63 deletions

View File

@@ -67,7 +67,6 @@ void FemPostFilter::setActiveFilterPipeline(std::string name) {
DocumentObjectExecReturn* FemPostFilter::execute(void) {
Base::Console().Message("Recalculate filter\n");
if(!m_pipelines.empty() && !m_activePipeline.empty()) {
FemPostFilter::FilterPipeline& pipe = m_pipelines[m_activePipeline];
@@ -76,7 +75,6 @@ DocumentObjectExecReturn* FemPostFilter::execute(void) {
Data.setValue(pipe.target->GetOutputDataObject(0));
}
Base::Console().Message("Done Recalculate filter\n");
return StdReturn;
}
@@ -165,6 +163,13 @@ short int FemPostClipFilter::mustExecute(void) const {
else return App::DocumentObject::mustExecute();
}
DocumentObjectExecReturn* FemPostClipFilter::execute(void) {
if(!m_extractor->GetImplicitFunction())
return StdReturn;
return Fem::FemPostFilter::execute();
}

View File

@@ -86,6 +86,7 @@ public:
return "FemGui::ViewProviderFemPostClip";
}
virtual short int mustExecute(void) const;
virtual App::DocumentObjectExecReturn* execute(void);
protected:
virtual void onChanged(const App::Property* prop);

View File

@@ -48,6 +48,7 @@
#include <vtkQuad.h>
#include <vtkImageData.h>
#include <vtkRectilinearGrid.h>
#include <vtkAppendFilter.h>
#include <vtkXMLUnstructuredGridReader.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLStructuredGridReader.h>
@@ -76,15 +77,42 @@ FemPostPipeline::~FemPostPipeline()
short FemPostPipeline::mustExecute(void) const
{
return 1;
if(Mode.isTouched())
return 1;
return FemPostFilter::mustExecute();
}
DocumentObjectExecReturn* FemPostPipeline::execute(void) {
//if we are the toplevel pipeline our data object is not created by filters, we are the main source!
if(!Input.getValue())
return StdReturn;
//now if we are a filter than our data object is created by the filter we hold
//if we are in serial mode we just copy over the data of the last filter,
//but if we are in parallel we need to combine all filter results
if(Mode.getValue() == 0) {
//serial
Data.setValue(getLastPostObject()->Data.getValue());
}
else {
//parallel. go through all filters and append the result
const std::vector<App::DocumentObject*>& filters = Filter.getValues();
std::vector<App::DocumentObject*>::const_iterator it = filters.begin();
vtkSmartPointer<vtkAppendFilter> append = vtkSmartPointer<vtkAppendFilter>::New();
for(;it != filters.end(); ++it) {
append->AddInputDataObject(static_cast<FemPostObject*>(*it)->Data.getValue());
}
append->Update();
Data.setValue(append->GetOutputDataObject(0));
}
return Fem::FemPostObject::execute();