OOFEM 3.0
Loading...
Searching...
No Matches
outputmanager.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 "outputmanager.h"
36#include "timestep.h"
37#include "engngm.h"
38#include "element.h"
39#include "dofmanager.h"
40#include "range.h"
41
42namespace oofem {
43OutputManager :: OutputManager(Domain *d) : dofman_out(), dofman_except(), element_out(), element_except()
44{
45 domain = d;
49}
50
51void
72
73void
74OutputManager :: doDofManOutput(FILE *file, TimeStep *tStep)
75{
76 int ndofman = domain->giveNumberOfDofManagers();
77
78 if ( !testTimeStepOutput(tStep) ) {
79 return;
80 }
81
82 fprintf(file, "\n\nDofManager output:\n------------------\n");
83
84 if ( dofman_all_out_flag && dofman_except.empty() ) {
85 for ( int i = 1; i <= ndofman; i++ ) {
86 // test for null dof in parallel mode
87 if ( domain->giveDofManager(i)->giveParallelMode() == DofManager_null ) {
88 continue;
89 }
90
91 domain->giveDofManager(i)->printOutputAt(file, tStep);
92 }
93 } else {
94 for ( int i = 1; i <= ndofman; i++ ) {
95 if ( _testDofManOutput(i) ) {
96 domain->giveDofManager(i)->printOutputAt(file, tStep);
97 }
98 }
99 }
100
101 fprintf(file, "\n\n");
102}
103
104void
105OutputManager :: doElementOutput(FILE *file, TimeStep *tStep)
106{
107 if ( !testTimeStepOutput(tStep) ) {
108 return;
109 }
110
111 fprintf(file, "\n\nElement output:\n---------------\n");
112
113 if ( element_all_out_flag && element_except.empty() ) {
114 for ( auto &elem : domain->giveElements() ) {
115 // test for remote element in parallel mode
116 if ( elem->giveParallelMode() == Element_remote ) {
117 continue;
118 }
119
120 elem->printOutputAt(file, tStep);
121 }
122 } else {
123 int nelem = domain->giveNumberOfElements();
124 for ( int i = 1; i <= nelem; i++ ) {
125 if ( _testElementOutput(i) ) {
126 domain->giveElement(i)->printOutputAt(file, tStep);
127 }
128 }
129 }
130
131 fprintf(file, "\n\n");
132}
133
134int
135OutputManager :: _testDofManOutput(int number)
136{
137 int selected = 0;
138
139 // test for null dof in parallel mode
140 if ( domain->giveDofManager(number)->giveParallelMode() == DofManager_null ) {
141 return 0;
142 }
143
144 // test all_select flag on
145 if ( dofman_all_out_flag ) {
146 selected = 1;
147 } else {
148 // test for particular dofman selection
149 int _label = domain->giveDofManager(number)->giveLabel();
150 for ( Range &range: dofman_out ) {
151 if ( range.test(_label) ) {
152 selected = 1;
153 break;
154 }
155 }
156 }
157
158 // if not selected exit
159 if ( !selected ) {
160 return 0;
161 }
162
163 // if selected check exclude list
164 int _label = domain->giveDofManager(number)->giveLabel();
165
166 for ( Range &range: this->dofman_except ) {
167 // test if excluded
168 if ( range.test(_label) ) {
169 return 0;
170 }
171 }
172
173 // dofman not excluded;
174 return selected;
175}
176
177
178int
179OutputManager :: _testElementOutput(int number)
180{
181 int selected = 0;
182
183 // test for remote element in parallel mode
184 if ( domain->giveElement(number)->giveParallelMode() == Element_remote ) {
185 return 0;
186 }
187
188 // test all_select flag on
189 if ( element_all_out_flag ) {
190 selected = 1;
191 } else {
192 // test for particular element selection
193 int _label = domain->giveElement(number)->giveLabel();
194
195 for ( Range &range: this->element_out ) {
196 if ( range.test(_label) ) {
197 selected = 1;
198 break;
199 }
200 }
201 }
202
203 // if not selected exit
204 if ( !selected ) {
205 return 0;
206 }
207
208 // if selected check exclude list
209 int _label = domain->giveElement(number)->giveLabel();
210
211 for ( Range &range: element_except ) {
212 // test if excluded
213 if ( range.test(_label) ) {
214 return 0;
215 }
216 }
217
218 // element not excluded;
219 return selected;
220}
221
222int
223OutputManager :: testTimeStepOutput(TimeStep *tStep)
224{
225 if ( tstep_all_out_flag ) {
226 return 1;
227 }
228
229 if ( tstep_step_out ) {
230 if ( ( ( tStep->giveNumber() - domain->giveEngngModel()->giveNumberOfFirstStep() ) % tstep_step_out ) == 0 ) {
231 return 1;
232 }
233 }
234
235 for ( Range &range: this->tsteps_out ) {
236 // test if INCLUDED
237 if ( range.test( tStep->giveNumber() ) ) {
238 return 1;
239 }
240 }
241
242 return 0;
243}
244
245int
246OutputManager :: testDofManOutput(int num, TimeStep *tStep)
247{
248 if ( testTimeStepOutput(tStep) ) {
249 if ( _testDofManOutput(num) ) {
250 return 1;
251 }
252 }
253
254 return 0;
255}
256
257int
258OutputManager :: testElementOutput(int num, TimeStep *tStep)
259{
260 if ( testTimeStepOutput(tStep) ) {
261 if ( _testElementOutput(num) ) {
262 return 1;
263 }
264 }
265
266 return 0;
267}
268
269void
270OutputManager :: beCopyOf(OutputManager *om)
271{
273 this->tstep_step_out = om->tstep_step_out;
276}
277} // end namespace oofem
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
int tstep_step_out
User timeStep Output step. Indicates every tstep_step_out-th step selected.
int _testDofManOutput(int number)
std ::list< Range > tsteps_out
List of user selected step numbers.
std ::list< Range > element_except
List of element numbers or their ranges being excluded.
std ::list< Range > dofman_out
List of dofmanager numbers or their ranges being selected.
int _testElementOutput(int number)
Domain * domain
Domain pointer.
int dofman_all_out_flag
Indicates all dofmanagers are selected.
OutputManager(Domain *d)
Creates empty Output Manager. By default all components are selected.
int tstep_all_out_flag
Indicates all steps selection.
std ::list< Range > element_out
List of element numbers or their ranges being selected.
std ::list< Range > dofman_except
List of dofmanager numbers or their ranges being excluded.
int element_all_out_flag
Indicates all elements are selected.
int testTimeStepOutput(TimeStep *)
int giveNumber()
Returns receiver's number.
Definition timestep.h:144
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
@ Element_remote
Element in active domain is only mirror of some remote element.
Definition element.h:89
@ DofManager_null
Definition dofmanager.h:74
#define _IFT_OutputManager_elementall
#define _IFT_OutputManager_tstepsout
#define _IFT_OutputManager_tstepall
#define _IFT_OutputManager_elementoutput
#define _IFT_OutputManager_elementexcept
#define _IFT_OutputManager_dofmanexcept
#define _IFT_OutputManager_dofmanoutput
#define _IFT_OutputManager_dofmanall
#define _IFT_OutputManager_tstepstep

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