OOFEM 3.0
Loading...
Searching...
No Matches
problemsequence.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#include "problemsequence.h"
36#include "inputrecord.h"
37#include "classfactory.h"
38#include "util.h"
39#include "inputrecord.h"
40#include "datastream.h"
41#include "oofemtxtdatareader.h"
42
43#include <memory>
44
45namespace oofem {
46
48
49ProblemSequence :: ProblemSequence(int i, EngngModel *master): EngngModel(i, master) {}
50
51ProblemSequence :: ~ProblemSequence() {}
52
53
54void ProblemSequence :: solveYourself()
55{
56 for ( auto &emodel : emodelList ) {
57 emodel->solveYourself();
59 // Options:
60 // 1. Use initial conditions (for both primary and internal fields!)
61 // 2. Copy domains over to the subsequent analysis
62 // 2 might be easier, but 1 has advantages outside of this type of analysis.
63 }
64}
65
66
67int ProblemSequence :: instanciateYourself(DataReader &dr, InputRecord &ir, const char *outFileName, const char *desc)
68{
69 int result = EngngModel :: instanciateYourself(dr, ir, dataOutputFileName.c_str(), desc);
70 ir.finish();
71
72 for ( auto &s : inputStreamNames ) {
74 std :: unique_ptr< EngngModel >prob( InstanciateProblem(dr, this->pMode, this->contextOutputMode, NULL) );
75 emodelList.emplace_back(std :: move(prob));
76 if ( prob ) {
77 return 0;
78 }
79 }
80
81 return result;
82}
83
84
85void ProblemSequence :: initializeFrom(InputRecord &ir)
86{
87 EngngModel :: initializeFrom(ir);
88
90}
91
92
93int ProblemSequence :: checkProblemConsistency()
94{
95 int ret = 1;
96 for (auto &emodel : emodelList) {
97 ret *= emodel->checkConsistency();
98 }
99 return ret;
100}
101
102
103void ProblemSequence :: saveContext(DataStream &stream, ContextMode mode)
104{
105 EngngModel :: saveContext(stream, mode);
106
107 stream.write(activeModel);
108
109 for ( auto &emodel : emodelList ) {
110 emodel->saveContext(stream, mode);
111 }
112}
113
114
115void ProblemSequence :: restoreContext(DataStream &stream, ContextMode mode)
116{
117 EngngModel :: restoreContext(stream, mode);
118
119 stream.read(activeModel);
120
121 for ( auto &emodel : emodelList ) {
122 emodel->restoreContext(stream, mode);
123 }
124}
125
126
127#ifdef __OOFEG
128void ProblemSequence :: drawYourself(oofegGraphicContext &gc) {}
129void ProblemSequence :: drawElements(oofegGraphicContext &gc) {}
130void ProblemSequence :: drawNodes(oofegGraphicContext &gc) {}
131
132#endif
133
134}
#define REGISTER_EngngModel(class)
virtual int read(int *data, std::size_t count)=0
Reads count integer values into array pointed by data.
virtual int write(const int *data, std::size_t count)=0
Writes count integer values from array pointed by data.
std::string dataOutputFileName
Path to output stream.
Definition engngm.h:248
problemMode pMode
Domain mode.
Definition engngm.h:267
ContextOutputMode contextOutputMode
Domain context output mode.
Definition engngm.h:256
virtual void finish(bool wrn=true)=0
Terminates the current record session and if the flag is true, warning is printed for unscanned token...
std ::vector< std ::unique_ptr< EngngModel > > emodelList
List of engineering models to solve sequentially.
std ::vector< std ::string > inputStreamNames
int activeModel
Keeps track of the active model in the analysis sequence.
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
long ContextMode
Definition contextmode.h:43
std::unique_ptr< EngngModel > InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
Definition util.C:153
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define _IFT_ProblemSequence_engineeringModels

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011