[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
committed by
Benjamin Nauck
parent
9fb0d7b0bb
commit
c15e45e7e2
@@ -55,9 +55,9 @@ FemPostBranchFilter::FemPostBranchFilter()
|
||||
* filter. We do not care if the input filter changes, as this is affecting only the passthrough
|
||||
* input and does not affect our child connections.
|
||||
* Dependent on our output mode, the passthrough is also used as output, but potentially
|
||||
* the append filter is used. in this case our children need to be connected into the append filter.
|
||||
* Here the same holds as before: Append filter output can be connected to arbitrary other filters
|
||||
* in the pipeline, not affecting our internal connections to our children.
|
||||
* the append filter is used. in this case our children need to be connected into the append
|
||||
* filter. Here the same holds as before: Append filter output can be connected to arbitrary
|
||||
* other filters in the pipeline, not affecting our internal connections to our children.
|
||||
*/
|
||||
|
||||
m_append = vtkSmartPointer<vtkAppendFilter>::New();
|
||||
@@ -112,10 +112,11 @@ void FemPostBranchFilter::setupPipeline()
|
||||
// serial: the next filter gets the previous output, the first one gets our input
|
||||
if (!filter) {
|
||||
nextFilter->getFilterInput()->SetInputConnection(m_passthrough->GetOutputPort());
|
||||
} else {
|
||||
nextFilter->getFilterInput()->SetInputConnection(filter->getFilterOutput()->GetOutputPort());
|
||||
}
|
||||
|
||||
else {
|
||||
nextFilter->getFilterInput()->SetInputConnection(
|
||||
filter->getFilterOutput()->GetOutputPort());
|
||||
}
|
||||
}
|
||||
else if (Mode.getValue() == Fem::PostGroupMode::Parallel) {
|
||||
// parallel: all filters get out input
|
||||
@@ -140,7 +141,7 @@ void FemPostBranchFilter::onChanged(const Property* prop)
|
||||
}
|
||||
|
||||
if (prop == &Frame) {
|
||||
//Update all children with the new step
|
||||
// Update all children with the new step
|
||||
for (const auto& obj : Group.getValues()) {
|
||||
if (obj->isDerivedFrom<FemPostFilter>()) {
|
||||
static_cast<Fem::FemPostFilter*>(obj)->Frame.setValue(Frame.getValue());
|
||||
@@ -172,7 +173,7 @@ void FemPostBranchFilter::onChanged(const Property* prop)
|
||||
void FemPostBranchFilter::filterChanged(FemPostFilter* filter)
|
||||
{
|
||||
|
||||
//we only need to update the following children if we are in serial mode
|
||||
// we only need to update the following children if we are in serial mode
|
||||
if (Mode.getValue() == Fem::PostGroupMode::Serial) {
|
||||
|
||||
std::vector<App::DocumentObject*> objs = Group.getValues();
|
||||
@@ -195,7 +196,8 @@ void FemPostBranchFilter::filterChanged(FemPostFilter* filter)
|
||||
|
||||
// if we append as output, we need to inform the parent object that we are isTouched
|
||||
if (Output.getValue() == 1) {
|
||||
//make sure we inform our parent object that we changed, it then can inform others if needed
|
||||
// make sure we inform our parent object that we changed, it then can inform others if
|
||||
// needed
|
||||
App::DocumentObject* group = FemPostGroupExtension::getGroupOfObject(this);
|
||||
if (!group) {
|
||||
return;
|
||||
@@ -207,7 +209,8 @@ void FemPostBranchFilter::filterChanged(FemPostFilter* filter)
|
||||
}
|
||||
}
|
||||
|
||||
void FemPostBranchFilter::filterPipelineChanged([[maybe_unused]] FemPostFilter* postfilter) {
|
||||
void FemPostBranchFilter::filterPipelineChanged([[maybe_unused]] FemPostFilter* postfilter)
|
||||
{
|
||||
// one of our filters has changed its active pipeline. We need to reconnect it properly.
|
||||
// As we are cheap we just reconnect everything
|
||||
// TODO: Do more efficiently
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
void setupPipeline();
|
||||
|
||||
vtkSmartPointer<vtkAppendFilter> m_append;
|
||||
vtkSmartPointer<vtkPassThrough> m_passthrough;
|
||||
vtkSmartPointer<vtkPassThrough> m_passthrough;
|
||||
};
|
||||
|
||||
} // namespace Fem
|
||||
|
||||
@@ -52,7 +52,6 @@ FemPostFilter::FemPostFilter()
|
||||
"Data",
|
||||
App::Prop_ReadOnly,
|
||||
"The step used to calculate the data");
|
||||
|
||||
}
|
||||
|
||||
FemPostFilter::~FemPostFilter() = default;
|
||||
@@ -72,21 +71,22 @@ void FemPostFilter::setActiveFilterPipeline(std::string name)
|
||||
if (m_activePipeline != name && isValid()) {
|
||||
|
||||
// disable all inputs of current pipeline
|
||||
if (m_activePipeline != "" && m_pipelines.find( m_activePipeline ) != m_pipelines.end()) {
|
||||
if (m_activePipeline != "" && m_pipelines.find(m_activePipeline) != m_pipelines.end()) {
|
||||
m_pipelines[m_activePipeline].source->RemoveAllInputConnections(0);
|
||||
}
|
||||
|
||||
// handle the transform
|
||||
if (m_use_transform) {
|
||||
m_transform_filter->RemoveAllInputConnections(0);
|
||||
if(m_transform_location == TransformLocation::output) {
|
||||
if (m_transform_location == TransformLocation::output) {
|
||||
m_transform_filter->SetInputConnection(m_pipelines[name].target->GetOutputPort(0));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_pipelines[name].source->SetInputConnection(m_transform_filter->GetOutputPort(0));
|
||||
}
|
||||
}
|
||||
|
||||
//set the new pipeline active
|
||||
// set the new pipeline active
|
||||
m_activePipeline = name;
|
||||
pipelineChanged();
|
||||
}
|
||||
@@ -94,8 +94,7 @@ void FemPostFilter::setActiveFilterPipeline(std::string name)
|
||||
|
||||
vtkSmartPointer<vtkAlgorithm> FemPostFilter::getFilterInput()
|
||||
{
|
||||
if (m_use_transform &&
|
||||
m_transform_location == TransformLocation::input) {
|
||||
if (m_use_transform && m_transform_location == TransformLocation::input) {
|
||||
|
||||
return m_transform_filter;
|
||||
}
|
||||
@@ -105,8 +104,7 @@ vtkSmartPointer<vtkAlgorithm> FemPostFilter::getFilterInput()
|
||||
|
||||
vtkSmartPointer<vtkAlgorithm> FemPostFilter::getFilterOutput()
|
||||
{
|
||||
if (m_use_transform &&
|
||||
m_transform_location == TransformLocation::output) {
|
||||
if (m_use_transform && m_transform_location == TransformLocation::output) {
|
||||
|
||||
return m_transform_filter;
|
||||
}
|
||||
@@ -114,8 +112,9 @@ vtkSmartPointer<vtkAlgorithm> FemPostFilter::getFilterOutput()
|
||||
return m_pipelines[m_activePipeline].target;
|
||||
}
|
||||
|
||||
void FemPostFilter::pipelineChanged() {
|
||||
//inform our parent, that we need to be reconnected
|
||||
void FemPostFilter::pipelineChanged()
|
||||
{
|
||||
// inform our parent, that we need to be reconnected
|
||||
App::DocumentObject* group = FemPostGroupExtension::getGroupOfObject(this);
|
||||
if (!group) {
|
||||
return;
|
||||
@@ -134,25 +133,29 @@ void FemPostFilter::onChanged(const App::Property* prop)
|
||||
// remove transform from pipeline
|
||||
if (m_transform_location == TransformLocation::output) {
|
||||
m_transform_filter->RemoveAllInputConnections(0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_pipelines[m_activePipeline].source->RemoveAllInputConnections(0);
|
||||
}
|
||||
m_use_transform = false;
|
||||
pipelineChanged();
|
||||
}
|
||||
if(!Placement.getValue().isIdentity() && !m_use_transform) {
|
||||
if (!Placement.getValue().isIdentity() && !m_use_transform) {
|
||||
// add transform to pipeline
|
||||
if (m_transform_location == TransformLocation::output) {
|
||||
m_transform_filter->SetInputConnection(m_pipelines[m_activePipeline].target->GetOutputPort(0));
|
||||
} else {
|
||||
m_pipelines[m_activePipeline].source->SetInputConnection(m_transform_filter->GetOutputPort(0));
|
||||
m_transform_filter->SetInputConnection(
|
||||
m_pipelines[m_activePipeline].target->GetOutputPort(0));
|
||||
}
|
||||
else {
|
||||
m_pipelines[m_activePipeline].source->SetInputConnection(
|
||||
m_transform_filter->GetOutputPort(0));
|
||||
}
|
||||
m_use_transform = true;
|
||||
pipelineChanged();
|
||||
}
|
||||
}
|
||||
|
||||
//make sure we inform our parent object that we changed, it then can inform others if needed
|
||||
// make sure we inform our parent object that we changed, it then can inform others if needed
|
||||
App::DocumentObject* group = FemPostGroupExtension::getGroupOfObject(this);
|
||||
if (group && group->hasExtension(FemPostGroupExtension::getExtensionClassTypeId())) {
|
||||
auto postgroup = group->getExtensionByType<FemPostGroupExtension>();
|
||||
@@ -179,7 +182,7 @@ DocumentObjectExecReturn* FemPostFilter::execute()
|
||||
return StdReturn;
|
||||
}
|
||||
|
||||
if (Frame.getValue()>0) {
|
||||
if (Frame.getValue() > 0) {
|
||||
output->UpdateTimeStep(Frame.getValue());
|
||||
}
|
||||
else {
|
||||
@@ -199,7 +202,7 @@ vtkSmartPointer<vtkDataSet> FemPostFilter::getInputData()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vtkAlgorithmOutput* output = active.source->GetInputConnection(0,0);
|
||||
vtkAlgorithmOutput* output = active.source->GetInputConnection(0, 0);
|
||||
vtkAlgorithm* algo = output->GetProducer();
|
||||
algo->Update();
|
||||
return vtkDataSet::SafeDownCast(algo->GetOutputDataObject(0));
|
||||
@@ -616,7 +619,8 @@ void FemPostClipFilter::onChanged(const Property* prop)
|
||||
if (auto* value = Base::freecad_dynamic_cast<FemPostFunction>(Function.getValue())) {
|
||||
m_clipper->SetClipFunction(value->getImplicitFunction());
|
||||
m_extractor->SetImplicitFunction(value->getImplicitFunction());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_clipper->SetClipFunction(m_defaultFunction);
|
||||
m_extractor->SetImplicitFunction(m_defaultFunction);
|
||||
}
|
||||
@@ -978,7 +982,6 @@ void FemPostContoursFilter::refreshFields()
|
||||
}
|
||||
|
||||
m_blockPropertyChanges = false;
|
||||
|
||||
}
|
||||
|
||||
void FemPostContoursFilter::refreshVectors()
|
||||
@@ -1077,7 +1080,8 @@ void FemPostCutFilter::onChanged(const Property* prop)
|
||||
if (prop == &Function) {
|
||||
if (auto* value = Base::freecad_dynamic_cast<FemPostFunction>(Function.getValue())) {
|
||||
m_cutter->SetCutFunction(value->getImplicitFunction());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_cutter->SetCutFunction(m_defaultFunction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
bool m_use_transform = false;
|
||||
TransformLocation m_transform_location = TransformLocation::output;
|
||||
|
||||
void pipelineChanged(); // inform parents that the pipeline changed
|
||||
void pipelineChanged(); // inform parents that the pipeline changed
|
||||
};
|
||||
|
||||
class FemExport FemPostSmoothFilterExtension: public App::DocumentObjectExtension
|
||||
|
||||
@@ -33,9 +33,7 @@ PROPERTY_SOURCE(Fem::FemPostFunctionProvider, App::DocumentObject)
|
||||
|
||||
FemPostFunctionProvider::FemPostFunctionProvider()
|
||||
: DocumentObjectGroup()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
FemPostFunctionProvider::~FemPostFunctionProvider() = default;
|
||||
|
||||
@@ -54,8 +52,8 @@ void FemPostFunctionProvider::unsetupObject()
|
||||
}
|
||||
|
||||
void FemPostFunctionProvider::handleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* typeName,
|
||||
const char* propName)
|
||||
const char* typeName,
|
||||
const char* propName)
|
||||
{
|
||||
if (strcmp(propName, "Functions") == 0
|
||||
&& Base::Type::fromName(typeName) == App::PropertyLinkList::getClassTypeId()) {
|
||||
|
||||
@@ -92,7 +92,9 @@ protected:
|
||||
void unsetupObject() override;
|
||||
|
||||
// update documents
|
||||
void handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName) override;
|
||||
void handleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* TypeName,
|
||||
const char* PropName) override;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -30,24 +30,26 @@ EXTENSION_PROPERTY_SOURCE(Fem::FemPostGroupExtension, App::GroupExtension);
|
||||
|
||||
const char* FemPostGroupExtension::ModeEnums[] = {"Serial", "Parallel", nullptr};
|
||||
|
||||
FemPostGroupExtension::FemPostGroupExtension() : App::GroupExtension() {
|
||||
FemPostGroupExtension::FemPostGroupExtension()
|
||||
: App::GroupExtension()
|
||||
{
|
||||
|
||||
initExtensionType(Fem::FemPostGroupExtension::getExtensionClassTypeId());
|
||||
|
||||
EXTENSION_ADD_PROPERTY_TYPE(Mode,
|
||||
(long(0)),
|
||||
"Pipeline",
|
||||
App::Prop_None,
|
||||
"Selects the pipeline data transition mode.\n"
|
||||
"In serial, every filter gets the output of the previous one as input.\n"
|
||||
"In parallel, every filter gets the pipeline source as input.\n");
|
||||
EXTENSION_ADD_PROPERTY_TYPE(
|
||||
Mode,
|
||||
(long(0)),
|
||||
"Pipeline",
|
||||
App::Prop_None,
|
||||
"Selects the pipeline data transition mode.\n"
|
||||
"In serial, every filter gets the output of the previous one as input.\n"
|
||||
"In parallel, every filter gets the pipeline source as input.\n");
|
||||
|
||||
Mode.setEnums(ModeEnums);
|
||||
}
|
||||
|
||||
FemPostGroupExtension::~FemPostGroupExtension() {
|
||||
|
||||
}
|
||||
FemPostGroupExtension::~FemPostGroupExtension()
|
||||
{}
|
||||
|
||||
|
||||
void FemPostGroupExtension::initExtension(App::ExtensionContainer* obj)
|
||||
@@ -62,16 +64,18 @@ void FemPostGroupExtension::initExtension(App::ExtensionContainer* obj)
|
||||
|
||||
void FemPostGroupExtension::extensionOnChanged(const App::Property* p)
|
||||
{
|
||||
if(p == &Group) {
|
||||
if (p == &Group) {
|
||||
if (!m_blockChange) {
|
||||
// sort the group, so that non filter objects are always on top (in case any object using this extension allows those)
|
||||
// sort the group, so that non filter objects are always on top (in case any object
|
||||
// using this extension allows those)
|
||||
auto objs = Group.getValues();
|
||||
std::sort( objs.begin( ), objs.end( ), [ ]( const App::DocumentObject* lhs, const App::DocumentObject* rhs ){
|
||||
|
||||
int l = lhs->isDerivedFrom<FemPostFilter>() ? 0 : 1;
|
||||
int r = rhs->isDerivedFrom<FemPostFilter>() ? 0 : 1;
|
||||
return r<l;
|
||||
});
|
||||
std::sort(objs.begin(),
|
||||
objs.end(),
|
||||
[](const App::DocumentObject* lhs, const App::DocumentObject* rhs) {
|
||||
int l = lhs->isDerivedFrom<FemPostFilter>() ? 0 : 1;
|
||||
int r = rhs->isDerivedFrom<FemPostFilter>() ? 0 : 1;
|
||||
return r < l;
|
||||
});
|
||||
m_blockChange = true;
|
||||
Group.setValue(objs);
|
||||
m_blockChange = false;
|
||||
@@ -82,7 +86,7 @@ void FemPostGroupExtension::extensionOnChanged(const App::Property* p)
|
||||
|
||||
std::vector<Fem::FemPostFilter*> FemPostGroupExtension::getFilter()
|
||||
{
|
||||
//collect all other items that are not filters
|
||||
// collect all other items that are not filters
|
||||
std::vector<Fem::FemPostFilter*> filters;
|
||||
for (auto& obj : Group.getValues()) {
|
||||
if (obj->isDerivedFrom<FemPostFilter>()) {
|
||||
|
||||
@@ -37,7 +37,8 @@ enum PostGroupMode
|
||||
};
|
||||
|
||||
// object grouping FEM filters and building the structure of the pipeline
|
||||
class FemExport FemPostGroupExtension : public App::GroupExtension {
|
||||
class FemExport FemPostGroupExtension: public App::GroupExtension
|
||||
{
|
||||
|
||||
using inherited = App::GroupExtension;
|
||||
EXTENSION_PROPERTY_HEADER_WITH_OVERRIDE(Fem::FemPostGroupExtension);
|
||||
|
||||
@@ -58,7 +58,8 @@ FemPostObject::FemPostObject()
|
||||
|
||||
FemPostObject::~FemPostObject() = default;
|
||||
|
||||
vtkDataSet* FemPostObject::getDataSet() {
|
||||
vtkDataSet* FemPostObject::getDataSet()
|
||||
{
|
||||
|
||||
if (!Data.getValue()) {
|
||||
return nullptr;
|
||||
@@ -99,7 +100,7 @@ PyObject* FemPostObject::getPyObject()
|
||||
|
||||
void FemPostObject::onChanged(const App::Property* prop)
|
||||
{
|
||||
if(prop == &Placement) {
|
||||
if (prop == &Placement) {
|
||||
// we update the transform filter to match the placement!
|
||||
double data[16];
|
||||
auto matrix = Placement.getValue().toMatrix();
|
||||
@@ -107,8 +108,8 @@ void FemPostObject::onChanged(const App::Property* prop)
|
||||
vtkTransform* transform = vtkTransform::New();
|
||||
transform->SetMatrix(data);
|
||||
m_transform_filter->SetTransform(transform);
|
||||
//note: no call to Update(), as we do not know the frame to use. has to happen
|
||||
//in derived class
|
||||
// note: no call to Update(), as we do not know the frame to use. has to happen
|
||||
// in derived class
|
||||
|
||||
// placement would not recompute, as it is a "not touch" prop.
|
||||
this->touch();
|
||||
@@ -123,7 +124,8 @@ namespace
|
||||
template<typename T>
|
||||
void femVTKWriter(const char* filename, const vtkSmartPointer<vtkDataObject>& dataObject)
|
||||
{
|
||||
if (dataObject->IsA("vtkDataSet") && vtkDataSet::SafeDownCast(dataObject)->GetNumberOfPoints() <= 0) {
|
||||
if (dataObject->IsA("vtkDataSet")
|
||||
&& vtkDataSet::SafeDownCast(dataObject)->GetNumberOfPoints() <= 0) {
|
||||
throw Base::ValueError("Empty data object");
|
||||
}
|
||||
|
||||
@@ -186,7 +188,8 @@ void FemPostObject::writeVTK(const char* filename) const
|
||||
|
||||
if (extension == "vtm") {
|
||||
femVTKWriter<vtkXMLMultiBlockDataWriter>(name.c_str(), data);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
femVTKWriter<vtkXMLDataSetWriter>(name.c_str(), data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ void FemFrameSourceAlgorithm::setDataObject(vtkSmartPointer<vtkDataObject> data)
|
||||
Update();
|
||||
}
|
||||
|
||||
bool FemFrameSourceAlgorithm::isValid() {
|
||||
bool FemFrameSourceAlgorithm::isValid()
|
||||
{
|
||||
return m_data.GetPointer() != nullptr;
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ int FemFrameSourceAlgorithm::RequestInformation(vtkInformation* reqInfo,
|
||||
vtkInformationVector* outVector)
|
||||
{
|
||||
|
||||
//setup default information
|
||||
// setup default information
|
||||
if (!this->Superclass::RequestInformation(reqInfo, inVector, outVector)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -308,7 +309,10 @@ void FemPostPipeline::read(Base::FileInfo File)
|
||||
Data.setValue(dataObjectFromFile(File));
|
||||
}
|
||||
|
||||
void FemPostPipeline::read(std::vector<Base::FileInfo>& files, std::vector<double>& values, Base::Unit unit, std::string& frame_type)
|
||||
void FemPostPipeline::read(std::vector<Base::FileInfo>& files,
|
||||
std::vector<double>& values,
|
||||
Base::Unit unit,
|
||||
std::string& frame_type)
|
||||
{
|
||||
if (files.size() != values.size()) {
|
||||
Base::Console().Error("Result files and frame values have different length.\n");
|
||||
@@ -366,7 +370,8 @@ App::DocumentObjectExecReturn* FemPostPipeline::execute()
|
||||
|
||||
double time = frames[Frame.getValue()];
|
||||
m_transform_filter->UpdateTimeStep(time);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_transform_filter->Update();
|
||||
}
|
||||
|
||||
@@ -437,7 +442,8 @@ void FemPostPipeline::onChanged(const Property* prop)
|
||||
m_block_property = true;
|
||||
Frame.setValue(val.c_str());
|
||||
m_block_property = false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// frame gets updated
|
||||
Frame.setValue(long(0));
|
||||
}
|
||||
@@ -447,7 +453,7 @@ void FemPostPipeline::onChanged(const Property* prop)
|
||||
|
||||
if (prop == &Frame && !m_block_property) {
|
||||
|
||||
//Update all children with the new frame
|
||||
// Update all children with the new frame
|
||||
double value = 0;
|
||||
auto frames = m_source_algorithm->getFrameValues();
|
||||
if (!frames.empty() && frames.size() > ulong(Frame.getValue())) {
|
||||
@@ -523,7 +529,7 @@ void FemPostPipeline::filterChanged(FemPostFilter* filter)
|
||||
|
||||
if (started) {
|
||||
obj->touch();
|
||||
if(obj->hasExtension(Fem::FemPostGroupExtension::getExtensionClassTypeId())) {
|
||||
if (obj->hasExtension(Fem::FemPostGroupExtension::getExtensionClassTypeId())) {
|
||||
obj->getExtension<FemPostGroupExtension>()->recomputeChildren();
|
||||
}
|
||||
}
|
||||
@@ -725,7 +731,8 @@ void FemPostPipeline::onDocumentRestored()
|
||||
{
|
||||
// if a old document was loaded with "custom" mode setting, the current value
|
||||
// would be out of range. Reset it to "serial"
|
||||
if (Mode.getValue() > Fem::PostGroupMode::Parallel || Mode.getValue() < Fem::PostGroupMode::Serial) {
|
||||
if (Mode.getValue() > Fem::PostGroupMode::Parallel
|
||||
|| Mode.getValue() < Fem::PostGroupMode::Serial) {
|
||||
Mode.setValue(Fem::PostGroupMode::Serial);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Fem
|
||||
|
||||
// algorithm that allows multi frame handling: if data is stored in MultiBlock dataset
|
||||
// this source enables the downstream filters to query the blocks as different time frames
|
||||
class FemFrameSourceAlgorithm : public vtkUnstructuredGridAlgorithm
|
||||
class FemFrameSourceAlgorithm: public vtkUnstructuredGridAlgorithm
|
||||
{
|
||||
public:
|
||||
static FemFrameSourceAlgorithm* New();
|
||||
@@ -59,8 +59,12 @@ protected:
|
||||
|
||||
vtkSmartPointer<vtkDataObject> m_data;
|
||||
|
||||
int RequestInformation(vtkInformation* reqInfo, vtkInformationVector** inVector, vtkInformationVector* outVector) override;
|
||||
int RequestData(vtkInformation* reqInfo, vtkInformationVector** inVector, vtkInformationVector* outVector) override;
|
||||
int RequestInformation(vtkInformation* reqInfo,
|
||||
vtkInformationVector** inVector,
|
||||
vtkInformationVector* outVector) override;
|
||||
int RequestData(vtkInformation* reqInfo,
|
||||
vtkInformationVector** inVector,
|
||||
vtkInformationVector* outVector) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -89,12 +93,18 @@ public:
|
||||
// load data from files (single or as multiframe)
|
||||
static bool canRead(Base::FileInfo file);
|
||||
void read(Base::FileInfo file);
|
||||
void read(std::vector<Base::FileInfo>& files, std::vector<double>& values, Base::Unit unit, std::string& frame_type);
|
||||
void read(std::vector<Base::FileInfo>& files,
|
||||
std::vector<double>& values,
|
||||
Base::Unit unit,
|
||||
std::string& frame_type);
|
||||
void scale(double s);
|
||||
|
||||
// load from results
|
||||
void load(FemResultObject* res);
|
||||
void load(std::vector<FemResultObject*>& res, std::vector<double>& values, Base::Unit unit, std::string& frame_type);
|
||||
void load(std::vector<FemResultObject*>& res,
|
||||
std::vector<double>& values,
|
||||
Base::Unit unit,
|
||||
std::string& frame_type);
|
||||
|
||||
// Group pipeline handling
|
||||
void filterChanged(FemPostFilter* filter) override;
|
||||
@@ -112,16 +122,18 @@ protected:
|
||||
bool allowObject(App::DocumentObject* obj) override;
|
||||
|
||||
// update documents
|
||||
void handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName) override;
|
||||
void handleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* TypeName,
|
||||
const char* PropName) override;
|
||||
void onDocumentRestored() override;
|
||||
|
||||
private:
|
||||
App::Enumeration m_frameEnum;
|
||||
App::Enumeration m_frameEnum;
|
||||
vtkSmartPointer<FemFrameSourceAlgorithm> m_source_algorithm;
|
||||
|
||||
bool m_block_property = false;
|
||||
bool m_data_updated = false;
|
||||
bool m_use_transform = false;
|
||||
bool m_data_updated = false;
|
||||
bool m_use_transform = false;
|
||||
void updateData();
|
||||
|
||||
|
||||
|
||||
@@ -45,12 +45,18 @@ std::string FemPostPipelinePy::representation() const
|
||||
|
||||
PyObject* FemPostPipelinePy::read(PyObject* args)
|
||||
{
|
||||
PyObject *files;
|
||||
PyObject *values = nullptr;
|
||||
PyObject *unitobj = nullptr;
|
||||
PyObject* files;
|
||||
PyObject* values = nullptr;
|
||||
PyObject* unitobj = nullptr;
|
||||
const char* value_type;
|
||||
|
||||
if (PyArg_ParseTuple(args, "O|OO!s", &files, &values, &(Base::UnitPy::Type), &unitobj, &value_type)) {
|
||||
if (PyArg_ParseTuple(args,
|
||||
"O|OO!s",
|
||||
&files,
|
||||
&values,
|
||||
&(Base::UnitPy::Type),
|
||||
&unitobj,
|
||||
&value_type)) {
|
||||
if (!values) {
|
||||
|
||||
// single argument version was called!
|
||||
@@ -64,12 +70,13 @@ PyObject* FemPostPipelinePy::read(PyObject* args)
|
||||
}
|
||||
else if (values && unitobj) {
|
||||
|
||||
//multistep version!
|
||||
// multistep version!
|
||||
|
||||
if ( !(PyTuple_Check(files) || PyList_Check(files)) ||
|
||||
!(PyTuple_Check(values) || PyList_Check(values)) ) {
|
||||
if (!(PyTuple_Check(files) || PyList_Check(files))
|
||||
|| !(PyTuple_Check(values) || PyList_Check(values))) {
|
||||
|
||||
std::string error = std::string("Files and values must be list of strings and number respectively.");
|
||||
std::string error = std::string(
|
||||
"Files and values must be list of strings and number respectively.");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
|
||||
@@ -87,7 +94,7 @@ PyObject* FemPostPipelinePy::read(PyObject* args)
|
||||
file_result[i] = Base::FileInfo(path.as_string());
|
||||
}
|
||||
|
||||
//extract the values
|
||||
// extract the values
|
||||
Py::Sequence values_list(values);
|
||||
size = values_list.size();
|
||||
std::vector<double> value_result;
|
||||
@@ -128,12 +135,18 @@ PyObject* FemPostPipelinePy::scale(PyObject* args)
|
||||
|
||||
PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
{
|
||||
PyObject *py;
|
||||
PyObject *list = nullptr;
|
||||
PyObject *unitobj = nullptr;
|
||||
PyObject* py;
|
||||
PyObject* list = nullptr;
|
||||
PyObject* unitobj = nullptr;
|
||||
const char* value_type;
|
||||
|
||||
if (PyArg_ParseTuple(args, "O|OO!s", &py, &list, &(Base::UnitPy::Type), &unitobj, &value_type)) {
|
||||
if (PyArg_ParseTuple(args,
|
||||
"O|OO!s",
|
||||
&py,
|
||||
&list,
|
||||
&(Base::UnitPy::Type),
|
||||
&unitobj,
|
||||
&value_type)) {
|
||||
|
||||
if (!list) {
|
||||
|
||||
@@ -143,7 +156,8 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
PyErr_SetString(PyExc_TypeError, "object is not a result object");
|
||||
return nullptr;
|
||||
}
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(py)->getDocumentObjectPtr();
|
||||
App::DocumentObject* obj =
|
||||
static_cast<App::DocumentObjectPy*>(py)->getDocumentObjectPtr();
|
||||
if (!obj->isDerivedFrom<FemResultObject>()) {
|
||||
PyErr_SetString(PyExc_TypeError, "object is not a result object");
|
||||
return nullptr;
|
||||
@@ -154,12 +168,13 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
}
|
||||
else if (list && unitobj) {
|
||||
|
||||
//multistep version!
|
||||
// multistep version!
|
||||
|
||||
if ( !(PyTuple_Check(py) || PyList_Check(py)) ||
|
||||
!(PyTuple_Check(list) || PyList_Check(list)) ) {
|
||||
if (!(PyTuple_Check(py) || PyList_Check(py))
|
||||
|| !(PyTuple_Check(list) || PyList_Check(list))) {
|
||||
|
||||
std::string error = std::string("Result and value must be list of ResultObject and number respectively.");
|
||||
std::string error = std::string(
|
||||
"Result and value must be list of ResultObject and number respectively.");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
|
||||
@@ -172,7 +187,8 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
for (Py::Sequence::size_type i = 0; i < size; i++) {
|
||||
Py::Object item = result_list[i];
|
||||
if (!PyObject_TypeCheck(*item, &(DocumentObjectPy::Type))) {
|
||||
std::string error = std::string("type in result list must be 'ResultObject', not ");
|
||||
std::string error =
|
||||
std::string("type in result list must be 'ResultObject', not ");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
auto obj = static_cast<DocumentObjectPy*>(*item)->getDocumentObjectPtr();
|
||||
@@ -182,7 +198,7 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
results[i] = static_cast<FemResultObject*>(obj);
|
||||
}
|
||||
|
||||
//extract the values
|
||||
// extract the values
|
||||
Py::Sequence values_list(list);
|
||||
size = values_list.size();
|
||||
std::vector<double> values;
|
||||
@@ -206,9 +222,10 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
// Finally call the c++ function!
|
||||
getFemPostPipelinePtr()->load(results, values, unit, step_type);
|
||||
Py_Return;
|
||||
|
||||
} else {
|
||||
std::string error = std::string("Multistep load requries 4 arguments: ResultList, ValueList, unit, type");
|
||||
}
|
||||
else {
|
||||
std::string error = std::string(
|
||||
"Multistep load requries 4 arguments: ResultList, ValueList, unit, type");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,10 +305,11 @@ void PropertyPostDataObject::Restore(Base::XMLReader& reader)
|
||||
}
|
||||
}
|
||||
|
||||
void add_to_zip(Base::FileInfo path, int zip_path_idx, zipios::ZipOutputStream& ZipWriter) {
|
||||
void add_to_zip(Base::FileInfo path, int zip_path_idx, zipios::ZipOutputStream& ZipWriter)
|
||||
{
|
||||
|
||||
if (path.isDir()) {
|
||||
for(auto file : path.getDirectoryContent()) {
|
||||
for (auto file : path.getDirectoryContent()) {
|
||||
add_to_zip(file, zip_path_idx, ZipWriter);
|
||||
}
|
||||
}
|
||||
@@ -344,7 +345,7 @@ void PropertyPostDataObject::SaveDocFile(Base::Writer& writer) const
|
||||
datafolder.createDirectories();
|
||||
auto datafile = Base::FileInfo(datafolder.filePath() + "/datafile.vtm");
|
||||
|
||||
//create the data: vtm file and subfolder with the subsequent data files
|
||||
// create the data: vtm file and subfolder with the subsequent data files
|
||||
xmlWriter = vtkSmartPointer<vtkXMLMultiBlockDataWriter>::New();
|
||||
xmlWriter->SetInputDataObject(m_dataObject);
|
||||
xmlWriter->SetFileName(datafile.filePath().c_str());
|
||||
@@ -356,14 +357,14 @@ void PropertyPostDataObject::SaveDocFile(Base::Writer& writer) const
|
||||
xmlWriter->SetFileName(fi.filePath().c_str());
|
||||
xmlWriter->SetDataModeToBinary();
|
||||
|
||||
#ifdef VTK_CELL_ARRAY_V2
|
||||
#ifdef VTK_CELL_ARRAY_V2
|
||||
// Looks like an invalid data object that causes a crash with vtk9
|
||||
vtkUnstructuredGrid* dataGrid = vtkUnstructuredGrid::SafeDownCast(m_dataObject);
|
||||
if (dataGrid && (dataGrid->GetPiece() < 0 || dataGrid->GetNumberOfPoints() <= 0)) {
|
||||
std::cerr << "PropertyPostDataObject::SaveDocFile: ignore empty vtkUnstructuredGrid\n";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (xmlWriter->Write() != 1) {
|
||||
@@ -389,7 +390,8 @@ void PropertyPostDataObject::SaveDocFile(Base::Writer& writer) const
|
||||
else if (m_dataObject->IsA("vtkMultiBlockDataSet")) {
|
||||
// ZIP file we store all data in
|
||||
zipios::ZipOutputStream ZipWriter(fi.filePath());
|
||||
ZipWriter.putNextEntry("dummy"); //need to add a dummy first, as the read stream preloads the first entry, and we cannot get the file name...
|
||||
ZipWriter.putNextEntry("dummy"); // need to add a dummy first, as the read stream preloads
|
||||
// the first entry, and we cannot get the file name...
|
||||
add_to_zip(datafolder, datafolder.filePath().length(), ZipWriter);
|
||||
ZipWriter.close();
|
||||
datafolder.deleteDirectoryRecursive();
|
||||
@@ -455,7 +457,7 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader& reader)
|
||||
|
||||
try {
|
||||
zipios::ConstEntryPointer entry = ZipReader.getNextEntry();
|
||||
while(entry->isValid()) {
|
||||
while (entry->isValid()) {
|
||||
Base::FileInfo entry_path(fo.filePath() + entry->getName());
|
||||
if (entry->isDirectory()) {
|
||||
// seems not to be called
|
||||
@@ -463,7 +465,7 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader& reader)
|
||||
}
|
||||
else {
|
||||
auto entry_dir = Base::FileInfo(entry_path.dirPath());
|
||||
if(!entry_dir.exists()) {
|
||||
if (!entry_dir.exists()) {
|
||||
entry_dir.createDirectories();
|
||||
}
|
||||
|
||||
@@ -480,7 +482,8 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader& reader)
|
||||
// there is no further entry
|
||||
}
|
||||
|
||||
// create the reader, and change the file for it to read. Also delete zip file, not needed anymore
|
||||
// create the reader, and change the file for it to read. Also delete zip file, not
|
||||
// needed anymore
|
||||
fi.deleteFile();
|
||||
fi = Base::FileInfo(fo.filePath() + "/datafile.vtm");
|
||||
xmlReader = vtkSmartPointer<vtkXMLMultiBlockDataReader>::New();
|
||||
|
||||
@@ -1839,15 +1839,18 @@ void setupFilter(Gui::Command* cmd, std::string Name)
|
||||
// at first we must determine the pipeline of the selection object
|
||||
// (which can be a pipeline itself)
|
||||
App::DocumentObject* pipeline = nullptr;
|
||||
if(selObject->hasExtension(Fem::FemPostGroupExtension::getExtensionClassTypeId())) {
|
||||
if (selObject->hasExtension(Fem::FemPostGroupExtension::getExtensionClassTypeId())) {
|
||||
pipeline = selObject;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pipeline = Fem::FemPostGroupExtension::getGroupOfObject(selObject);
|
||||
if (!pipeline || !pipeline->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(),
|
||||
qApp->translate("setupFilter", "Error: Object not in a post processing group"),
|
||||
qApp->translate("setupFilter", "The filter could not be set up: Object not in a post processing group."));
|
||||
qApp->translate(
|
||||
"setupFilter",
|
||||
"The filter could not be set up: Object not in a post processing group."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1861,7 +1864,8 @@ void setupFilter(Gui::Command* cmd, std::string Name)
|
||||
// add it as subobject to the pipeline
|
||||
cmd->doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addObject(App.ActiveDocument.%s)",
|
||||
pipeline->getNameInDocument(), FeatName.c_str());
|
||||
pipeline->getNameInDocument(),
|
||||
FeatName.c_str());
|
||||
|
||||
// set display to assure the user sees the new object
|
||||
cmd->doCommand(Gui::Command::Doc,
|
||||
@@ -1878,7 +1882,7 @@ void setupFilter(Gui::Command* cmd, std::string Name)
|
||||
auto selObjectView = static_cast<FemGui::ViewProviderFemPostObject*>(
|
||||
Gui::Application::Instance->getViewProvider(selObject));
|
||||
|
||||
//TODO: FIX
|
||||
// TODO: FIX
|
||||
/*cmd->doCommand(Gui::Command::Doc,
|
||||
"App.activeDocument().ActiveObject.ViewObject.Field = \"%s\"",
|
||||
selObjectView->Field.getValueAsString());
|
||||
@@ -2026,7 +2030,7 @@ bool CmdFemPostClipFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2063,7 +2067,7 @@ bool CmdFemPostCutFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2100,7 +2104,7 @@ bool CmdFemPostDataAlongLineFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2138,7 +2142,7 @@ bool CmdFemPostDataAtPointFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2251,7 +2255,7 @@ bool CmdFemPostScalarClipFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2288,7 +2292,7 @@ bool CmdFemPostWarpVectorFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2325,7 +2329,7 @@ bool CmdFemPostContoursFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2397,7 +2401,8 @@ void CmdFemPostFunctions::activated(int iMsg)
|
||||
"App.activeDocument().addObject('Fem::FemPost%sFunction','%s')",
|
||||
name.c_str(),
|
||||
FeatName.c_str());
|
||||
doCommand(Doc, "App.ActiveDocument.%s.addObject(App.ActiveDocument.%s)",
|
||||
doCommand(Doc,
|
||||
"App.ActiveDocument.%s.addObject(App.ActiveDocument.%s)",
|
||||
provider->getNameInDocument(),
|
||||
FeatName.c_str());
|
||||
|
||||
@@ -2723,7 +2728,7 @@ bool CmdFemPostBranchFilter::isActive()
|
||||
return false;
|
||||
}
|
||||
// only activate if a post object is selected
|
||||
for (auto obj : selection ) {
|
||||
for (auto obj : selection) {
|
||||
if (obj.pObject->isDerivedFrom<Fem::FemPostObject>()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,18 +30,18 @@
|
||||
using namespace FemGui;
|
||||
|
||||
|
||||
PROPERTY_SOURCE_WITH_EXTENSIONS(FemGui::ViewProviderFemPostBranchFilter, FemGui::ViewProviderFemPostObject)
|
||||
PROPERTY_SOURCE_WITH_EXTENSIONS(FemGui::ViewProviderFemPostBranchFilter,
|
||||
FemGui::ViewProviderFemPostObject)
|
||||
|
||||
ViewProviderFemPostBranchFilter::ViewProviderFemPostBranchFilter() : Gui::ViewProviderGroupExtension()
|
||||
ViewProviderFemPostBranchFilter::ViewProviderFemPostBranchFilter()
|
||||
: Gui::ViewProviderGroupExtension()
|
||||
{
|
||||
Gui::ViewProviderGroupExtension::initExtension(this);
|
||||
sPixmap = "FEM_PostBranchFilter";
|
||||
}
|
||||
|
||||
ViewProviderFemPostBranchFilter::~ViewProviderFemPostBranchFilter()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
void ViewProviderFemPostBranchFilter::setupTaskDialog(TaskDlgPost* dlg)
|
||||
{
|
||||
@@ -52,11 +52,14 @@ void ViewProviderFemPostBranchFilter::setupTaskDialog(TaskDlgPost* dlg)
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
}
|
||||
|
||||
bool ViewProviderFemPostBranchFilter::acceptReorderingObjects() const {
|
||||
bool ViewProviderFemPostBranchFilter::acceptReorderingObjects() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ViewProviderFemPostBranchFilter::canDragObjectToTarget(App::DocumentObject*, App::DocumentObject* target) const {
|
||||
bool ViewProviderFemPostBranchFilter::canDragObjectToTarget(App::DocumentObject*,
|
||||
App::DocumentObject* target) const
|
||||
{
|
||||
|
||||
// allow drag only to other post groups
|
||||
if (target) {
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace FemGui
|
||||
|
||||
class TaskDlgPost;
|
||||
|
||||
class FemGuiExport ViewProviderFemPostBranchFilter: public ViewProviderFemPostObject, public Gui::ViewProviderGroupExtension
|
||||
class FemGuiExport ViewProviderFemPostBranchFilter: public ViewProviderFemPostObject,
|
||||
public Gui::ViewProviderGroupExtension
|
||||
{
|
||||
PROPERTY_HEADER_WITH_EXTENSIONS(FemGui::ViewProviderFemPostBranchFilter);
|
||||
|
||||
@@ -51,15 +52,15 @@ protected:
|
||||
|
||||
// change default group drag/drop behaviour sligthly
|
||||
bool acceptReorderingObjects() const override;
|
||||
bool canDragObjectToTarget(App::DocumentObject* obj, App::DocumentObject* target) const override;
|
||||
bool canDragObjectToTarget(App::DocumentObject* obj,
|
||||
App::DocumentObject* target) const override;
|
||||
|
||||
// override, to not show/hide children as the parent is shown/hidden like normal groups
|
||||
void extensionHide() override {};
|
||||
void extensionShow() override {};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace FemGui
|
||||
|
||||
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTBRANCHFILTER_H
|
||||
|
||||
@@ -129,9 +129,8 @@ bool ViewProviderFemPostFunctionProvider::onDelete(const std::vector<std::string
|
||||
// warn the user if the object has unselected children
|
||||
auto objs = claimChildren();
|
||||
return ViewProviderFemAnalysis::checkSelectedChildren(objs,
|
||||
this->getDocument(),
|
||||
"functions list");
|
||||
|
||||
this->getDocument(),
|
||||
"functions list");
|
||||
}
|
||||
|
||||
bool ViewProviderFemPostFunctionProvider::canDelete(App::DocumentObject* obj) const
|
||||
|
||||
@@ -1072,7 +1072,7 @@ bool ViewProviderFemPostObject::onDelete(const std::vector<std::string>&)
|
||||
};
|
||||
|
||||
// delete all subelements
|
||||
for(auto obj : objs) {
|
||||
for (auto obj : objs) {
|
||||
getObject()->getDocument()->removeObject(obj->getNameInDocument());
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -58,8 +58,7 @@ void ViewProviderFemPostPipeline::updateData(const App::Property* prop)
|
||||
FemGui::ViewProviderFemPostObject::updateData(prop);
|
||||
|
||||
Fem::FemPostPipeline* pipeline = getObject<Fem::FemPostPipeline>();
|
||||
if ((prop == &pipeline->Data) ||
|
||||
(prop == &pipeline->Group)) {
|
||||
if ((prop == &pipeline->Data) || (prop == &pipeline->Group)) {
|
||||
|
||||
updateFunctionSize();
|
||||
}
|
||||
@@ -226,11 +225,14 @@ void ViewProviderFemPostPipeline::setupTaskDialog(TaskDlgPost* dlg)
|
||||
}
|
||||
|
||||
|
||||
bool ViewProviderFemPostPipeline::acceptReorderingObjects() const {
|
||||
bool ViewProviderFemPostPipeline::acceptReorderingObjects() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ViewProviderFemPostPipeline::canDragObjectToTarget(App::DocumentObject*, App::DocumentObject* target) const {
|
||||
bool ViewProviderFemPostPipeline::canDragObjectToTarget(App::DocumentObject*,
|
||||
App::DocumentObject* target) const
|
||||
{
|
||||
|
||||
// allow drag only to other post groups
|
||||
if (target) {
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
namespace FemGui
|
||||
{
|
||||
|
||||
class FemGuiExport ViewProviderFemPostPipeline: public ViewProviderFemPostObject, public Gui::ViewProviderGroupExtension
|
||||
class FemGuiExport ViewProviderFemPostPipeline: public ViewProviderFemPostObject,
|
||||
public Gui::ViewProviderGroupExtension
|
||||
{
|
||||
|
||||
PROPERTY_HEADER_WITH_EXTENSIONS(FemGui::ViewProviderFemPostPipeline);
|
||||
@@ -57,7 +58,8 @@ protected:
|
||||
|
||||
// change default group drag/drop behaviour sligthly
|
||||
bool acceptReorderingObjects() const override;
|
||||
bool canDragObjectToTarget(App::DocumentObject* obj, App::DocumentObject* target) const override;
|
||||
bool canDragObjectToTarget(App::DocumentObject* obj,
|
||||
App::DocumentObject* target) const override;
|
||||
|
||||
// override, to not show/hide children as the parent is shown/hidden like normal groups
|
||||
void extensionHide() override {};
|
||||
|
||||
@@ -646,7 +646,6 @@ def makePostVtkResult(doc, result_data, name="VtkResult"):
|
||||
needed for a multistep result: [results_list, value_list, unit, description]
|
||||
"""
|
||||
|
||||
|
||||
Pipeline_Name = "Pipeline_" + name
|
||||
obj = doc.addObject("Fem::FemPostPipeline", Pipeline_Name)
|
||||
obj.load(*result_data)
|
||||
|
||||
@@ -62,7 +62,6 @@ def setupPipeline(doc, analysis, results_name, result_data):
|
||||
import ObjectsFem
|
||||
from . import importToolsFem
|
||||
|
||||
|
||||
# create a results pipeline if not already existing
|
||||
pipeline_name = "Pipeline_" + results_name
|
||||
pipeline_obj = doc.getObject(pipeline_name)
|
||||
@@ -223,7 +222,6 @@ def importFrd(filename, analysis=None, result_name_prefix="", result_analysis_ty
|
||||
multistep_value.append(step_time)
|
||||
multistep_result.append(res_obj)
|
||||
|
||||
|
||||
# we have collected all result objects, lets create the multistep result pipeline
|
||||
if number_of_increments > 1:
|
||||
# figure out type and unit
|
||||
@@ -244,8 +242,12 @@ def importFrd(filename, analysis=None, result_name_prefix="", result_analysis_ty
|
||||
unit = FreeCAD.Units.Unit()
|
||||
description = "Unknown"
|
||||
|
||||
setupPipeline(doc, analysis, results_name, [multistep_result, multistep_value, unit, description])
|
||||
|
||||
setupPipeline(
|
||||
doc,
|
||||
analysis,
|
||||
results_name,
|
||||
[multistep_result, multistep_value, unit, description],
|
||||
)
|
||||
|
||||
elif result_analysis_type == "check":
|
||||
results_name = f"{result_name_prefix}Check"
|
||||
|
||||
@@ -309,7 +309,6 @@ class Results(run.Results):
|
||||
# but not the shape and bar coloring
|
||||
self.solver.ElmerResult.ViewObject.updateColorBars()
|
||||
|
||||
|
||||
def _getResultFile(self):
|
||||
postPath = None
|
||||
# elmer post file path changed with version x.x
|
||||
|
||||
Reference in New Issue
Block a user