OOFEM
3.0
Loading...
Searching...
No Matches
src
core
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
45
namespace
oofem
{
46
47
REGISTER_EngngModel
(
ProblemSequence
)
48
49
ProblemSequence :: ProblemSequence(
int
i,
EngngModel
*master):
EngngModel
(i, master) {}
50
51
ProblemSequence :: ~ProblemSequence() {}
52
53
54
void
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
67
int
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
) {
73
OOFEMTXTDataReader
dr(
inputStreamNames
[ i - 1 ] );
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
85
void
ProblemSequence :: initializeFrom(
InputRecord
&ir)
86
{
87
EngngModel :: initializeFrom(ir);
88
89
IR_GIVE_FIELD
(ir,
inputStreamNames
,
_IFT_ProblemSequence_engineeringModels
);
90
}
91
92
93
int
ProblemSequence :: checkProblemConsistency()
94
{
95
int
ret = 1;
96
for
(
auto
&emodel :
emodelList
) {
97
ret *= emodel->checkConsistency();
98
}
99
return
ret;
100
}
101
102
103
void
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
115
void
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
128
void
ProblemSequence :: drawYourself(
oofegGraphicContext
&
gc
) {}
129
void
ProblemSequence :: drawElements(
oofegGraphicContext
&
gc
) {}
130
void
ProblemSequence :: drawNodes(
oofegGraphicContext
&
gc
) {}
131
132
#endif
133
134
}
classfactory.h
REGISTER_EngngModel
#define REGISTER_EngngModel(class)
Definition
classfactory.h:137
oofem::DataReader
Definition
datareader.h:55
oofem::DataStream
Definition
datastream.h:55
oofem::DataStream::read
virtual int read(int *data, std::size_t count)=0
Reads count integer values into array pointed by data.
oofem::DataStream::write
virtual int write(const int *data, std::size_t count)=0
Writes count integer values from array pointed by data.
oofem::EngngModel
Definition
engngm.h:192
oofem::EngngModel::dataOutputFileName
std::string dataOutputFileName
Path to output stream.
Definition
engngm.h:248
oofem::EngngModel::pMode
problemMode pMode
Domain mode.
Definition
engngm.h:267
oofem::EngngModel::contextOutputMode
ContextOutputMode contextOutputMode
Domain context output mode.
Definition
engngm.h:256
oofem::InputRecord
Definition
inputrecord.h:98
oofem::InputRecord::finish
virtual void finish(bool wrn=true)=0
Terminates the current record session and if the flag is true, warning is printed for unscanned token...
oofem::OOFEMTXTDataReader
Definition
oofemtxtdatareader.h:53
oofem::ProblemSequence
Definition
problemsequence.h:59
oofem::ProblemSequence::emodelList
std ::vector< std ::unique_ptr< EngngModel > > emodelList
List of engineering models to solve sequentially.
Definition
problemsequence.h:62
oofem::ProblemSequence::inputStreamNames
std ::vector< std ::string > inputStreamNames
Definition
problemsequence.h:63
oofem::ProblemSequence::activeModel
int activeModel
Keeps track of the active model in the analysis sequence.
Definition
problemsequence.h:66
oofem::oofegGraphicContext
Definition
oofeggraphiccontext.h:133
datastream.h
inputrecord.h
IR_GIVE_FIELD
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition
inputrecord.h:67
oofem
Definition
additivemanufacturingproblem.C:83
oofem::ContextMode
long ContextMode
Definition
contextmode.h:43
oofem::InstanciateProblem
std::unique_ptr< EngngModel > InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
Definition
util.C:153
gc
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
oofemtxtdatareader.h
problemsequence.h
_IFT_ProblemSequence_engineeringModels
#define _IFT_ProblemSequence_engineeringModels
Definition
problemsequence.h:44
util.h
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