1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 cfMesh is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 A controller fo managing the mesh generation workflow. It allows the user
29 to stop the meshing process after selected steps in the workflow,
30 and restart from a selected point.
35 \*---------------------------------------------------------------------------*/
37 #ifndef workflowControls_H
38 #define workflowControls_H
40 #include "objectRegistry.H"
42 #include "IOdictionary.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class workflowControls Declaration
56 \*---------------------------------------------------------------------------*/
58 class workflowControls
61 //- reference to the mesh
64 //- current step in the workflow
67 //- step for restarting the workflow
68 word restartAfterStep_;
70 //- completed step before restart
71 DynList<word> completedStepsBeforeRestart_;
73 //- holds information whether the workflow has been restarted
74 mutable bool isRestarted_;
76 // static private data
77 static const std::map<word, label> workflowSteps_;
79 // Private member functions
80 //- check if restart is requested
81 bool restartRequested() const;
83 //- sets the current step to completed
84 void setStepCompleted() const;
86 //- is the current step already completed
87 bool isStepCompleted() const;
89 //- shall the procedure stop after the current step
90 bool exitAfterCurrentStep() const;
92 //- return the latest completed step
93 word lastCompletedStep() const;
95 //- return the names of completed steps
96 DynList<word> completedSteps() const;
98 //- remove completedStep from the dictionary
99 void clearCompletedSteps();
101 //- shall the workflow stop after the current step
102 bool stopAfterCurrentStep() const;
104 //- shall the workflow run after the current step
105 bool runAfterCurrentStep() const;
107 // Static private member functions
108 //- populate workflowSteps with values
109 static std::map<word, label> populateWorkflowSteps();
115 //- Construct from IOdictionary
116 workflowControls(polyMeshGen& mesh);
121 // Public member functions
123 //- shall the process run the current step
124 bool runCurrentStep(const word&);
126 //- set the workflow completed flag
127 void workflowCompleted();
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 } // End namespace Foam
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 // ************************************************************************* //