From 5bd81cab56e6fb0a09639910392159709d0713dd Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Fri, 6 Apr 2018 13:39:10 +0200 Subject: [PATCH] STYLE: reorganize subdir names, adjust method catalystCoprocess method name - was check(), now query() - emit/suppress information output based on 'log' setting (as per other functionObjects) --- src/catalyst/CMakeLists-Common.txt | 22 ++--- src/catalyst/{ => areaMesh}/catalystFaMesh.C | 35 +++---- src/catalyst/{ => areaMesh}/catalystFaMesh.H | 10 +- .../{ => areaMesh}/foamVtkFaMeshAdaptor.C | 0 .../{ => areaMesh}/foamVtkFaMeshAdaptor.H | 0 .../foamVtkFaMeshAdaptorFieldTemplates.C | 0 .../foamVtkFaMeshAdaptorFields.C | 0 .../{ => areaMesh}/foamVtkFaMeshAdaptorGeom.C | 0 src/catalyst/catalystCoprocess.C | 96 +++++++++---------- src/catalyst/catalystCoprocess.H | 47 ++++----- src/catalyst/{ => cloud}/catalystCloud.C | 33 ++++--- src/catalyst/{ => cloud}/catalystCloud.H | 10 +- .../{ => cloud}/foamVtkCloudAdaptor.C | 0 .../{ => cloud}/foamVtkCloudAdaptor.H | 0 .../foamVtkCloudAdaptorTemplates.C | 0 src/catalyst/{ => volMesh}/catalystFvMesh.C | 43 +++++---- src/catalyst/{ => volMesh}/catalystFvMesh.H | 10 +- .../{ => volMesh}/foamVtkFvMeshAdaptor.C | 0 .../{ => volMesh}/foamVtkFvMeshAdaptor.H | 1 + .../foamVtkFvMeshAdaptorFieldTemplates.C | 0 .../foamVtkFvMeshAdaptorFields.C | 0 .../{ => volMesh}/foamVtkFvMeshAdaptorGeom.C | 0 .../foamVtkFvMeshAdaptorGeomVtu.C | 0 .../icoFoam/cavity/system/catalyst.cfg | 1 + 24 files changed, 166 insertions(+), 142 deletions(-) rename src/catalyst/{ => areaMesh}/catalystFaMesh.C (92%) rename src/catalyst/{ => areaMesh}/catalystFaMesh.H (93%) rename src/catalyst/{ => areaMesh}/foamVtkFaMeshAdaptor.C (100%) rename src/catalyst/{ => areaMesh}/foamVtkFaMeshAdaptor.H (100%) rename src/catalyst/{ => areaMesh}/foamVtkFaMeshAdaptorFieldTemplates.C (100%) rename src/catalyst/{ => areaMesh}/foamVtkFaMeshAdaptorFields.C (100%) rename src/catalyst/{ => areaMesh}/foamVtkFaMeshAdaptorGeom.C (100%) rename src/catalyst/{ => cloud}/catalystCloud.C (89%) rename src/catalyst/{ => cloud}/catalystCloud.H (93%) rename src/catalyst/{ => cloud}/foamVtkCloudAdaptor.C (100%) rename src/catalyst/{ => cloud}/foamVtkCloudAdaptor.H (100%) rename src/catalyst/{ => cloud}/foamVtkCloudAdaptorTemplates.C (100%) rename src/catalyst/{ => volMesh}/catalystFvMesh.C (90%) rename src/catalyst/{ => volMesh}/catalystFvMesh.H (93%) rename src/catalyst/{ => volMesh}/foamVtkFvMeshAdaptor.C (100%) rename src/catalyst/{ => volMesh}/foamVtkFvMeshAdaptor.H (99%) rename src/catalyst/{ => volMesh}/foamVtkFvMeshAdaptorFieldTemplates.C (100%) rename src/catalyst/{ => volMesh}/foamVtkFvMeshAdaptorFields.C (100%) rename src/catalyst/{ => volMesh}/foamVtkFvMeshAdaptorGeom.C (100%) rename src/catalyst/{ => volMesh}/foamVtkFvMeshAdaptorGeomVtu.C (100%) diff --git a/src/catalyst/CMakeLists-Common.txt b/src/catalyst/CMakeLists-Common.txt index 3ad14d2..acbfc7c 100644 --- a/src/catalyst/CMakeLists-Common.txt +++ b/src/catalyst/CMakeLists-Common.txt @@ -43,19 +43,19 @@ set(LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN} file(GLOB SOURCE_FILES catalystCoprocess.C - catalystCloud.C - foamVtkCloudAdaptor.C + cloud/catalystCloud.C + cloud/foamVtkCloudAdaptor.C - catalystFaMesh.C - foamVtkFaMeshAdaptor.C - foamVtkFaMeshAdaptorGeom.C - foamVtkFaMeshAdaptorFields.C + areaMesh/catalystFaMesh.C + areaMesh/foamVtkFaMeshAdaptor.C + areaMesh/foamVtkFaMeshAdaptorGeom.C + areaMesh/foamVtkFaMeshAdaptorFields.C - catalystFvMesh.C - foamVtkFvMeshAdaptor.C - foamVtkFvMeshAdaptorGeom.C - foamVtkFvMeshAdaptorGeomVtu.C - foamVtkFvMeshAdaptorFields.C + volMesh/catalystFvMesh.C + volMesh/foamVtkFvMeshAdaptor.C + volMesh/foamVtkFvMeshAdaptorGeom.C + volMesh/foamVtkFvMeshAdaptorGeomVtu.C + volMesh/foamVtkFvMeshAdaptorFields.C ) set(OPENFOAM_LIBRARIES diff --git a/src/catalyst/catalystFaMesh.C b/src/catalyst/areaMesh/catalystFaMesh.C similarity index 92% rename from src/catalyst/catalystFaMesh.C rename to src/catalyst/areaMesh/catalystFaMesh.C index 7b5ef24..1e1a7be 100644 --- a/src/catalyst/catalystFaMesh.C +++ b/src/catalyst/areaMesh/catalystFaMesh.C @@ -175,8 +175,6 @@ bool Foam::functionObjects::catalystFaMesh::execute() return false; } - const catalystCoprocess::timeQuery when(time_); - // Enforce sanity for backends and adaptor { bool updateAdaptor = false; @@ -213,36 +211,42 @@ bool Foam::functionObjects::catalystFaMesh::execute() // Data description for co-processing vtkNew<vtkCPDataDescription> descrip; - // Form query for catalyst - catalystCoprocess::dataQuery query + // Form data query for catalyst + catalystCoprocess::dataQuery dataq ( vtk::faMeshAdaptor::channelNames.names(), - when, + time_, // timeQuery descrip.Get() ); // Query catalyst - HashTable<wordHashSet> expecting = adaptor_().check(query, allFields); + const HashTable<wordHashSet> expecting(adaptor_().query(dataq, allFields)); - if (expecting.empty()) + if (catalystCoprocess::debug) { - Info<< "No data expected for ParaView Catalyst. " << when << endl; - return true; + if (expecting.empty()) + { + Info<< type() << ": expecting no data" << nl; + } + else + { + Info<< type() << ": expecting data " << expecting << nl; + } } - else if (catalystCoprocess::debug) + + if (expecting.empty()) { - Info<< type() << " expecting data:" << expecting << endl; + return true; } auto output = vtkSmartPointer<vtkMultiBlockDataSet>::New(); // TODO: currently don't rely on the results from expecting much at all - // Store each region in a separate block + // Each region in a separate block unsigned int regionNo = 0; for (const word& regionName : regionNames) { -#if 1 auto pieces = backends_[regionName]->output(selectFields_); output->SetBlock(regionNo, pieces); @@ -252,15 +256,14 @@ bool Foam::functionObjects::catalystFaMesh::execute() vtkCompositeDataSet::NAME(), regionName ); -#endif ++regionNo; } if (regionNo) { - Info<< "Send data to ParaView Catalyst. " << when << endl; + Log << type() << ": send data" << nl; - adaptor_().process(query, output); + adaptor_().process(dataq, output); } return true; diff --git a/src/catalyst/catalystFaMesh.H b/src/catalyst/areaMesh/catalystFaMesh.H similarity index 93% rename from src/catalyst/catalystFaMesh.H rename to src/catalyst/areaMesh/catalystFaMesh.H index 597e75a..a01c154 100644 --- a/src/catalyst/catalystFaMesh.H +++ b/src/catalyst/areaMesh/catalystFaMesh.H @@ -50,15 +50,23 @@ Usage \table Property | Description | Required | Default type | catalyst::area | yes | + log | report extra information | no | false region | | no | region0 regions | wordRe list of regions | no | fields | wordRe list of fields | yes | scripts | Python pipeline scripts | yes | \endtable +Note + The execution frequency can be defined by the functionObject and + by the Catalyst pipeline. + See also + Foam::functionObjects::functionObject Foam::functionObjects::fvMeshFunctionObject Foam::functionObjects::timeControl + Foam::catalystCoprocess + Foam::vtk::faMeshAdaptor SourceFiles catalystFaMesh.C @@ -153,7 +161,7 @@ public: //- Read the specification virtual bool read(const dictionary& dict); - //- Execute pipeline + //- Execute catalyst pipelines virtual bool execute(); //- Write - does nothing diff --git a/src/catalyst/foamVtkFaMeshAdaptor.C b/src/catalyst/areaMesh/foamVtkFaMeshAdaptor.C similarity index 100% rename from src/catalyst/foamVtkFaMeshAdaptor.C rename to src/catalyst/areaMesh/foamVtkFaMeshAdaptor.C diff --git a/src/catalyst/foamVtkFaMeshAdaptor.H b/src/catalyst/areaMesh/foamVtkFaMeshAdaptor.H similarity index 100% rename from src/catalyst/foamVtkFaMeshAdaptor.H rename to src/catalyst/areaMesh/foamVtkFaMeshAdaptor.H diff --git a/src/catalyst/foamVtkFaMeshAdaptorFieldTemplates.C b/src/catalyst/areaMesh/foamVtkFaMeshAdaptorFieldTemplates.C similarity index 100% rename from src/catalyst/foamVtkFaMeshAdaptorFieldTemplates.C rename to src/catalyst/areaMesh/foamVtkFaMeshAdaptorFieldTemplates.C diff --git a/src/catalyst/foamVtkFaMeshAdaptorFields.C b/src/catalyst/areaMesh/foamVtkFaMeshAdaptorFields.C similarity index 100% rename from src/catalyst/foamVtkFaMeshAdaptorFields.C rename to src/catalyst/areaMesh/foamVtkFaMeshAdaptorFields.C diff --git a/src/catalyst/foamVtkFaMeshAdaptorGeom.C b/src/catalyst/areaMesh/foamVtkFaMeshAdaptorGeom.C similarity index 100% rename from src/catalyst/foamVtkFaMeshAdaptorGeom.C rename to src/catalyst/areaMesh/foamVtkFaMeshAdaptorGeom.C diff --git a/src/catalyst/catalystCoprocess.C b/src/catalyst/catalystCoprocess.C index a7bc793..5f137ac 100644 --- a/src/catalyst/catalystCoprocess.C +++ b/src/catalyst/catalystCoprocess.C @@ -42,7 +42,7 @@ License namespace Foam { -defineTypeNameAndDebug(catalystCoprocess, 0); + defineTypeNameAndDebug(catalystCoprocess, 0); } @@ -121,64 +121,60 @@ Foam::label Foam::catalystCoprocess::expand template<class DataType> bool Foam::catalystCoprocess::processImpl ( - const dataQuery& query, - HashTable<vtkSmartPointer<DataType>>& outputs + const dataQuery& dataq, + vtkSmartPointer<DataType>& output ) { - vtkCPDataDescription* descrip = query.get(); + vtkCPDataDescription* descrip = dataq.get(); if (!coproc_->RequestDataDescription(descrip)) { return false; } - for (const word& channel : query.channels()) + for (const word& chanName : dataq.channels()) { - if (outputs.found(channel)) - { - auto* input = descrip->GetInputDescriptionByName(channel.c_str()); + auto* input = descrip->GetInputDescriptionByName(chanName.c_str()); - if (input && input->GetIfGridIsNecessary()) - { - input->SetGrid(outputs[channel]); - } + if (input && input->GetIfGridIsNecessary()) + { + input->SetGrid(output); } } coproc_->CoProcess(descrip); - return true; } template<class DataType> -bool Foam::catalystCoprocess::process1Impl +bool Foam::catalystCoprocess::processImpl ( - const dataQuery& query, - vtkSmartPointer<DataType>& output + const dataQuery& dataq, + HashTable<vtkSmartPointer<DataType>>& outputs ) { - vtkCPDataDescription* descrip = query.get(); + vtkCPDataDescription* descrip = dataq.get(); if (!coproc_->RequestDataDescription(descrip)) { return false; } - for (const word& channel : query.channels()) + for (const word& chanName : dataq.channels()) { - auto* input = descrip->GetInputDescriptionByName(channel.c_str()); - - if (input && input->GetIfGridIsNecessary()) + if (outputs.found(chanName)) { - input->SetGrid(output); - } + auto* input = descrip->GetInputDescriptionByName(chanName.c_str()); - break; + if (input && input->GetIfGridIsNecessary()) + { + input->SetGrid(outputs[chanName]); + } + } } coproc_->CoProcess(descrip); - return true; } @@ -256,14 +252,14 @@ void Foam::catalystCoprocess::reset(const UList<string>& scripts) coproc_->AddPipeline(pipeline.GetPointer()); } - // Do something different with (!nscript) ?? + // Do something different with (nscript == 0) ? } Foam::HashTable<Foam::wordHashSet> -Foam::catalystCoprocess::check +Foam::catalystCoprocess::query ( - dataQuery& query, + dataQuery& dataq, const wordHashSet& allFields ) { @@ -276,37 +272,33 @@ Foam::catalystCoprocess::check return requests; } - if (query.channels().empty()) + if (dataq.channels().empty()) { // No channels names have been published by the simulation return requests; } - vtkCPDataDescription* descrip = query.get(); + vtkCPDataDescription* descrip = dataq.get(); - descrip->SetTimeData(query.timeValue, query.timeIndex); - descrip->SetForceOutput(query.forced); + descrip->SetTimeData(dataq.timeValue, dataq.timeIndex); + descrip->SetForceOutput(dataq.forced); // Sort out which channels already exist, are new, or disappeared { // The currently defined channels - wordHashSet currentChannels; + wordHashSet currChannels; const unsigned n = descrip->GetNumberOfInputDescriptions(); for (unsigned i=0; i < n; ++i) { - currentChannels.insert + currChannels.insert ( - word - ( - descrip->GetInputDescriptionName(i), - false // no stripping (ie, accept bad names too) - ) + word::validate(descrip->GetInputDescriptionName(i)) ); } - wordHashSet newChannels(query.channels()); - wordHashSet oldChannels(currentChannels); + wordHashSet newChannels(dataq.channels()); + wordHashSet oldChannels(currChannels); oldChannels.erase(newChannels); if (oldChannels.size()) @@ -315,14 +307,14 @@ Foam::catalystCoprocess::check } else { - newChannels.erase(currentChannels); + newChannels.erase(currChannels); } // Add channels - for (const word& channel : newChannels) + for (const word& chanName : newChannels) { - descrip->AddInput(channel.c_str()); - auto* input = descrip->GetInputDescriptionByName(channel.c_str()); + descrip->AddInput(chanName.c_str()); + auto* input = descrip->GetInputDescriptionByName(chanName.c_str()); for (const word& fieldName : allFields) { @@ -344,13 +336,13 @@ Foam::catalystCoprocess::check return requests; } - for (const word& channel : query.channels()) + for (const word& chanName : dataq.channels()) { - auto* input = descrip->GetInputDescriptionByName(channel.c_str()); + auto* input = descrip->GetInputDescriptionByName(chanName.c_str()); if (input && input->GetIfGridIsNecessary()) { - wordHashSet& fields = requests(channel); + wordHashSet& fields = requests(chanName); // auto-vivify for (const word& fieldName : allFields) { @@ -368,21 +360,21 @@ Foam::catalystCoprocess::check bool Foam::catalystCoprocess::process ( - const dataQuery& query, + const dataQuery& dataq, vtkSmartPointer<vtkMultiBlockDataSet>& output ) { - return process1Impl(query, output); + return processImpl(dataq, output); } bool Foam::catalystCoprocess::process ( - const dataQuery& query, + const dataQuery& dataq, HashTable<vtkSmartPointer<vtkMultiBlockDataSet>>& outputs ) { - return processImpl(query, outputs); + return processImpl(dataq, outputs); } diff --git a/src/catalyst/catalystCoprocess.H b/src/catalyst/catalystCoprocess.H index 2995ee8..754b79f 100644 --- a/src/catalyst/catalystCoprocess.H +++ b/src/catalyst/catalystCoprocess.H @@ -28,24 +28,18 @@ Description Low-level interface between OpenFOAM and ParaView Catalyst. \code - ... initialize catalyst + ... initialize catalyst - ... define a data query for catalyst + ... define a data query for catalyst - // Data description for co-processing - vtkNew<vtkCPDataDescription> descrip; + // Data description for co-processing + vtkNew<vtkCPDataDescription> descrip; - // Form query for catalyst - catalystCoprocess::dataQuery query - ( - vtkPVFoam::channelNames.names(), - when, - descrip.Get() - ); + // Form data query for catalyst + catalystCoprocess::dataQuery dataq(channelNames, runTime, descrip.Get()); // Query catalyst - HashTable<wordHashSet> expecting = adaptor_().check(query, allFields); - + HashTable<wordHashSet> expecting = adaptor_().query(dataq, fields); \endcode @@ -116,9 +110,8 @@ public: : public timeQuery { - //- Catalyst channels to query + //- Catalyst channel names to query List<word> channels_; - mutable vtkCPDataDescription* descrip_; public: @@ -169,18 +162,20 @@ private: // Private Member Functions + //- Process single output channel template<class DataType> bool processImpl ( const dataQuery& query, - HashTable<vtkSmartPointer<DataType>>& outputs + vtkSmartPointer<DataType>& outputs ); + //- Process multiple output channels template<class DataType> - bool process1Impl + bool processImpl ( const dataQuery& query, - vtkSmartPointer<DataType>& outputs + HashTable<vtkSmartPointer<DataType>>& outputs ); public: @@ -223,36 +218,34 @@ public: //- Query the coprocess pipelines if they should be executed at this //- iteration and possibly which fields they require. // - // \param[in,out] query for catalyst. + // \param[in,out] dataq the data query for catalyst. // On input it contains the published channel names, the current // simulation time (index, value) and allocation for the coprocess // data description. - // On output the data description willbe filled with the field names - // contains the published channel names, the current + // On output the data description will be filled with the field + // names added per channel. // \param[in] allFields the fields that can be published from the // simulation. // // \return HashTable with fields requested (what Catalyst expects) // on a per-channel basis. - HashTable<wordHashSet> check + HashTable<wordHashSet> query ( - dataQuery& query, + dataQuery& dataq, const wordHashSet& allFields ); //- Single-channel source (eg, "input" or "cloud", ...) - // Uses the currentTime values bool process ( - const dataQuery& query, + const dataQuery& dataq, vtkSmartPointer<vtkMultiBlockDataSet>& output ); //- Multi-channel source (eg, "input", "mesh", "patches") - // Uses the currentTime values bool process ( - const dataQuery& query, + const dataQuery& dataq, HashTable<vtkSmartPointer<vtkMultiBlockDataSet>>& outputs ); diff --git a/src/catalyst/catalystCloud.C b/src/catalyst/cloud/catalystCloud.C similarity index 89% rename from src/catalyst/catalystCloud.C rename to src/catalyst/cloud/catalystCloud.C index f297dce..1066d6b 100644 --- a/src/catalyst/catalystCloud.C +++ b/src/catalyst/cloud/catalystCloud.C @@ -123,8 +123,6 @@ bool Foam::functionObjects::catalystCloud::execute() return true; } - const catalystCoprocess::timeQuery when(time_); - // Enforce sanity for backends and adaptor { if (!adaptor_.valid()) @@ -143,30 +141,37 @@ bool Foam::functionObjects::catalystCloud::execute() // Data description for co-processing vtkNew<vtkCPDataDescription> descrip; - // Form query for catalyst - catalystCoprocess::dataQuery query + // Form data query for catalyst + catalystCoprocess::dataQuery dataq ( vtk::cloudAdaptor::channelNames.names(), - when, + time_, // timeQuery descrip.Get() ); // Query catalyst - HashTable<wordHashSet> expecting = adaptor_().check(query, allFields); + const HashTable<wordHashSet> expecting(adaptor_().query(dataq, allFields)); - if (expecting.empty()) + if (catalystCoprocess::debug) { - Info<< "No data expected for ParaView Catalyst. " << when << endl; - return true; + if (expecting.empty()) + { + Info<< type() << ": expecting no data" << nl; + } + else + { + Info<< type() << ": expecting data " << expecting << nl; + } } - else if (catalystCoprocess::debug) + + if (expecting.empty()) { - Info<< type() << " expecting data:" << expecting << endl; + return true; } auto output = vtkSmartPointer<vtkMultiBlockDataSet>::New(); - // Store each cloud in a separate block + // Each cloud in a separate block. unsigned int cloudNo = 0; for (const word& cloudName : cloudNames) { @@ -185,9 +190,9 @@ bool Foam::functionObjects::catalystCloud::execute() if (cloudNo) { - Info<< "Send data to ParaView Catalyst. " << when << endl; + Log << type() << ": send data" << nl; - adaptor_().process(query, output); + adaptor_().process(dataq, output); } return true; diff --git a/src/catalyst/catalystCloud.H b/src/catalyst/cloud/catalystCloud.H similarity index 93% rename from src/catalyst/catalystCloud.H rename to src/catalyst/cloud/catalystCloud.H index 4271bca..1d9afb1 100644 --- a/src/catalyst/catalystCloud.H +++ b/src/catalyst/cloud/catalystCloud.H @@ -51,6 +51,7 @@ Usage \table Property | Description | Required | Default value type | catalyst::cloud | yes | + log | report extra information | no | false cloud | | no | defaultCloud clouds | wordRe list of clouds | no | region | | no | region0 @@ -59,9 +60,16 @@ Usage scripts | Python pipeline scripts | yes | \endtable +Note + The execution frequency can be defined by the functionObject and + by the Catalyst pipeline. + See also + Foam::functionObjects::functionObject Foam::functionObjects::fvMeshFunctionObject Foam::functionObjects::timeControl + Foam::catalystCoprocess + Foam::vtk::cloudAdaptor SourceFiles catalystCloud.C @@ -146,7 +154,7 @@ public: //- Read the specification virtual bool read(const dictionary& dict); - //- Execute pipeline + //- Execute catalyst pipelines virtual bool execute(); //- Write - does nothing diff --git a/src/catalyst/foamVtkCloudAdaptor.C b/src/catalyst/cloud/foamVtkCloudAdaptor.C similarity index 100% rename from src/catalyst/foamVtkCloudAdaptor.C rename to src/catalyst/cloud/foamVtkCloudAdaptor.C diff --git a/src/catalyst/foamVtkCloudAdaptor.H b/src/catalyst/cloud/foamVtkCloudAdaptor.H similarity index 100% rename from src/catalyst/foamVtkCloudAdaptor.H rename to src/catalyst/cloud/foamVtkCloudAdaptor.H diff --git a/src/catalyst/foamVtkCloudAdaptorTemplates.C b/src/catalyst/cloud/foamVtkCloudAdaptorTemplates.C similarity index 100% rename from src/catalyst/foamVtkCloudAdaptorTemplates.C rename to src/catalyst/cloud/foamVtkCloudAdaptorTemplates.C diff --git a/src/catalyst/catalystFvMesh.C b/src/catalyst/volMesh/catalystFvMesh.C similarity index 90% rename from src/catalyst/catalystFvMesh.C rename to src/catalyst/volMesh/catalystFvMesh.C index b935430..de2f830 100644 --- a/src/catalyst/catalystFvMesh.C +++ b/src/catalyst/volMesh/catalystFvMesh.C @@ -160,8 +160,6 @@ bool Foam::functionObjects::catalystFvMesh::execute() return false; } - const catalystCoprocess::timeQuery when(time_); - // Enforce sanity for backends and adaptor { bool updateAdaptor = false; @@ -198,40 +196,47 @@ bool Foam::functionObjects::catalystFvMesh::execute() // Data description for co-processing vtkNew<vtkCPDataDescription> descrip; - // Form query for catalyst - catalystCoprocess::dataQuery query + // Form data query for catalyst + catalystCoprocess::dataQuery dataq ( vtk::fvMeshAdaptor::channelNames.names(), - when, + time_, // timeQuery descrip.Get() ); // Query catalyst - HashTable<wordHashSet> expecting = adaptor_().check(query, allFields); + const HashTable<wordHashSet> expecting(adaptor_().query(dataq, allFields)); - if (expecting.empty()) + if (catalystCoprocess::debug) { - Info<< "No data expected for ParaView Catalyst. " << when << endl; - return true; + if (expecting.empty()) + { + Info<< type() << ": expecting no data" << nl; + } + else + { + Info<< type() << ": expecting data " << expecting << nl; + } } - else if (catalystCoprocess::debug) + + if (expecting.empty()) { - Info<< type() << " expecting data:" << expecting << endl; + return true; } HashTable<vtkSmartPointer<vtkMultiBlockDataSet>> outputs; // TODO: currently don't rely on the results from expecting much at all - // Store each region in a separate block + // Each region in a separate block. unsigned int regionNo = 0; for (const word& regionName : regionNames) { // (re)define output channels backends_[regionName]->channels(expecting.toc()); - vtkSmartPointer<vtkMultiBlockDataSet> dataset - = backends_[regionName]->output(selectFields_); + vtkSmartPointer<vtkMultiBlockDataSet> dataset = + backends_[regionName]->output(selectFields_); { const unsigned int channelNo = 0; // MESH @@ -258,7 +263,7 @@ bool Foam::functionObjects::catalystFvMesh::execute() regionName ); - outputs.set(channelName, block); // overwrite existing + outputs.set(channelName, block); // overwrite existing } } @@ -287,7 +292,7 @@ bool Foam::functionObjects::catalystFvMesh::execute() regionName ); - outputs.set(channelName, block); // overwrite existing + outputs.set(channelName, block); // overwrite existing } } @@ -314,7 +319,7 @@ bool Foam::functionObjects::catalystFvMesh::execute() regionName ); - outputs.set(channelName, block); // overwrite existing + outputs.set(channelName, block); // overwrite existing } } @@ -323,9 +328,9 @@ bool Foam::functionObjects::catalystFvMesh::execute() if (regionNo) { - Info<< "Send data to ParaView Catalyst. " << when << endl; + Log << type() << ": send data" << nl; - adaptor_().process(query, outputs); + adaptor_().process(dataq, outputs); } return true; diff --git a/src/catalyst/catalystFvMesh.H b/src/catalyst/volMesh/catalystFvMesh.H similarity index 93% rename from src/catalyst/catalystFvMesh.H rename to src/catalyst/volMesh/catalystFvMesh.H index 7556503..5a694c5 100644 --- a/src/catalyst/catalystFvMesh.H +++ b/src/catalyst/volMesh/catalystFvMesh.H @@ -51,15 +51,23 @@ Usage \table Property | Description | Required | Default type | catalyst | yes | + log | report extra information | no | false region | | no | region0 regions | wordRe list of regions | no | fields | wordRe list of fields | yes | scripts | Python pipeline scripts | yes | \endtable +Note + The execution frequency can be defined by the functionObject and + by the Catalyst pipeline. + See also Foam::functionObjects::functionObject + Foam::functionObjects::fvMeshFunctionObject Foam::functionObjects::timeControl + Foam::catalystCoprocess + Foam::vtk::fvMeshAdaptor SourceFiles catalystFvMesh.C @@ -157,7 +165,7 @@ public: //- Read the specification virtual bool read(const dictionary& dict); - //- Execute pipeline + //- Execute catalyst pipelines virtual bool execute(); //- Write - does nothing diff --git a/src/catalyst/foamVtkFvMeshAdaptor.C b/src/catalyst/volMesh/foamVtkFvMeshAdaptor.C similarity index 100% rename from src/catalyst/foamVtkFvMeshAdaptor.C rename to src/catalyst/volMesh/foamVtkFvMeshAdaptor.C diff --git a/src/catalyst/foamVtkFvMeshAdaptor.H b/src/catalyst/volMesh/foamVtkFvMeshAdaptor.H similarity index 99% rename from src/catalyst/foamVtkFvMeshAdaptor.H rename to src/catalyst/volMesh/foamVtkFvMeshAdaptor.H index 35969eb..4b8460d 100644 --- a/src/catalyst/foamVtkFvMeshAdaptor.H +++ b/src/catalyst/volMesh/foamVtkFvMeshAdaptor.H @@ -31,6 +31,7 @@ Description to the internal (volume) mesh (block 0) and the patches as (block 1). These two blocks correspond simultaneously to the catalyst channels "mesh" and "patches", respectively. + The patches are further divided into sub-blocks. The lowest data blocks are multi-piece datasets (UnstructuredGrid and PolyData for internal mesh and patches, respectively) with each piece corresponding to its MPI rank. diff --git a/src/catalyst/foamVtkFvMeshAdaptorFieldTemplates.C b/src/catalyst/volMesh/foamVtkFvMeshAdaptorFieldTemplates.C similarity index 100% rename from src/catalyst/foamVtkFvMeshAdaptorFieldTemplates.C rename to src/catalyst/volMesh/foamVtkFvMeshAdaptorFieldTemplates.C diff --git a/src/catalyst/foamVtkFvMeshAdaptorFields.C b/src/catalyst/volMesh/foamVtkFvMeshAdaptorFields.C similarity index 100% rename from src/catalyst/foamVtkFvMeshAdaptorFields.C rename to src/catalyst/volMesh/foamVtkFvMeshAdaptorFields.C diff --git a/src/catalyst/foamVtkFvMeshAdaptorGeom.C b/src/catalyst/volMesh/foamVtkFvMeshAdaptorGeom.C similarity index 100% rename from src/catalyst/foamVtkFvMeshAdaptorGeom.C rename to src/catalyst/volMesh/foamVtkFvMeshAdaptorGeom.C diff --git a/src/catalyst/foamVtkFvMeshAdaptorGeomVtu.C b/src/catalyst/volMesh/foamVtkFvMeshAdaptorGeomVtu.C similarity index 100% rename from src/catalyst/foamVtkFvMeshAdaptorGeomVtu.C rename to src/catalyst/volMesh/foamVtkFvMeshAdaptorGeomVtu.C diff --git a/tutorials/incompressible/icoFoam/cavity/system/catalyst.cfg b/tutorials/incompressible/icoFoam/cavity/system/catalyst.cfg index 5696a70..d171523 100644 --- a/tutorials/incompressible/icoFoam/cavity/system/catalyst.cfg +++ b/tutorials/incompressible/icoFoam/cavity/system/catalyst.cfg @@ -16,6 +16,7 @@ FoamFile type catalyst; libs ("libcatalystFoam.so"); +log false; executeControl timeStep; // Fallback scripts -- GitLab