From c413ec5009943ae6592493e3febae7b95293946f Mon Sep 17 00:00:00 2001 From: Vaggelis Papoutsis <vaggelisp@gmail.com> Date: Tue, 31 Dec 2019 20:46:22 +0200 Subject: [PATCH] BUG: writeMorpherCPs expects a controlBoxes entry The controlBoxes wordList was removed from NURBS3DVolume in the pre-release phase but writeMorpherCPs was not updated accordingly. TUT: added the invocation of writeMorpherCPs in one of the tutotials to help identify future regression --- .../writeMorpherCPs/writeMorpherCPs.C | 48 ++++++++++--------- .../turbulent/primalAdjointFullSetup/Allrun | 1 + 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/applications/utilities/preProcessing/optimisation/writeMorpherCPs/writeMorpherCPs.C b/applications/utilities/preProcessing/optimisation/writeMorpherCPs/writeMorpherCPs.C index 2b70f305685..4729ac3bf34 100644 --- a/applications/utilities/preProcessing/optimisation/writeMorpherCPs/writeMorpherCPs.C +++ b/applications/utilities/preProcessing/optimisation/writeMorpherCPs/writeMorpherCPs.C @@ -45,33 +45,37 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - IOdictionary dict + const dictionary NURBSdict ( - IOobject + IOdictionary ( - "dynamicMeshDict", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ) + ).subDict("volumetricBSplinesMotionSolverCoeffs") ); + // Read box names and allocate size + wordList controlBoxes(NURBSdict.toc()); - const dictionary& coeffDict = - dict.subDict("volumetricBSplinesMotionSolverCoeffs"); - - wordList controlBoxes(coeffDict.get<wordList>("controlBoxes")); - - forAll(controlBoxes, iNURB) + for (const word& boxName : controlBoxes) { - // Creating an object writes the control points in the - // constructor - NURBS3DVolume::New - ( - coeffDict.subDict(controlBoxes[iNURB]), - mesh, - false // do not compute parametric coordinates - ); + if (NURBSdict.isDict(boxName)) + { + // Creating an object writes the control points in the + // constructor + NURBS3DVolume::New + ( + NURBSdict.subDict(boxName), + mesh, + false // do not compute parametric coordinates + ); + } } Info<< "End\n" << endl; diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/primalAdjointFullSetup/Allrun b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/primalAdjointFullSetup/Allrun index 69abef2dca9..7c9b06005f0 100755 --- a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/primalAdjointFullSetup/Allrun +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/primalAdjointFullSetup/Allrun @@ -7,6 +7,7 @@ resourcesDir=$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/resources \cp $resourcesDir/param/sbend/* 0 \cp -r $resourcesDir/meshes/sbend/polyMesh constant +runApplication writeMorpherCPs runApplication decomposePar runParallel $(getApplication) -- GitLab