OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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 
42 namespace oofem {
43 OutputManager :: OutputManager(Domain *d) : dofman_out(), dofman_except(), element_out(), element_except()
44 {
45  domain = d;
47  tstep_step_out = 0;
49 }
50 
53 {
54  IRResultType result; // Required by IR_GIVE_FIELD macro
55 
57  tstep_step_out = 0;
59 
62 
63  tsteps_out.clear();
65  dofman_out.clear();
67  dofman_except.clear();
69  element_out.clear();
71  element_except.clear();
73 
74  return IRRT_OK;
75 }
76 
77 void
79 {
80  int ndofman = domain->giveNumberOfDofManagers();
81 
82  if ( !testTimeStepOutput(tStep) ) {
83  return;
84  }
85 
86  fprintf(file, "\n\nDofManager output:\n------------------\n");
87 
88  if ( dofman_all_out_flag && dofman_except.empty() ) {
89  for ( int i = 1; i <= ndofman; i++ ) {
90  // test for null dof in parallel mode
92  continue;
93  }
94 
95  domain->giveDofManager(i)->printOutputAt(file, tStep);
96  }
97  } else {
98  for ( int i = 1; i <= ndofman; i++ ) {
99  if ( _testDofManOutput(i) ) {
100  domain->giveDofManager(i)->printOutputAt(file, tStep);
101  }
102  }
103  }
104 
105  fprintf(file, "\n\n");
106 }
107 
108 void
110 {
111  if ( !testTimeStepOutput(tStep) ) {
112  return;
113  }
114 
115  fprintf(file, "\n\nElement output:\n---------------\n");
116 
117  if ( element_all_out_flag && element_except.empty() ) {
118  for ( auto &elem : domain->giveElements() ) {
119  // test for remote element in parallel mode
120  if ( elem->giveParallelMode() == Element_remote ) {
121  continue;
122  }
123 
124  elem->printOutputAt(file, tStep);
125  }
126  } else {
127  int nelem = domain->giveNumberOfElements();
128  for ( int i = 1; i <= nelem; i++ ) {
129  if ( _testElementOutput(i) ) {
130  domain->giveElement(i)->printOutputAt(file, tStep);
131  }
132  }
133  }
134 
135  fprintf(file, "\n\n");
136 }
137 
138 int
140 {
141  int selected = 0;
142 
143  // test for null dof in parallel mode
144  if ( domain->giveDofManager(number)->giveParallelMode() == DofManager_null ) {
145  return 0;
146  }
147 
148  // test all_select flag on
149  if ( dofman_all_out_flag ) {
150  selected = 1;
151  } else {
152  // test for particular dofman selection
153  int _label = domain->giveDofManager(number)->giveLabel();
154  for ( Range &range: dofman_out ) {
155  if ( range.test(_label) ) {
156  selected = 1;
157  break;
158  }
159  }
160  }
161 
162  // if not selected exit
163  if ( !selected ) {
164  return 0;
165  }
166 
167  // if selected check exclude list
168  int _label = domain->giveDofManager(number)->giveLabel();
169 
170  for ( Range &range: this->dofman_except ) {
171  // test if excluded
172  if ( range.test(_label) ) {
173  return 0;
174  }
175  }
176 
177  // dofman not excluded;
178  return selected;
179 }
180 
181 
182 int
184 {
185  int selected = 0;
186 
187  // test for remote element in parallel mode
188  if ( domain->giveElement(number)->giveParallelMode() == Element_remote ) {
189  return 0;
190  }
191 
192  // test all_select flag on
193  if ( element_all_out_flag ) {
194  selected = 1;
195  } else {
196  // test for particular element selection
197  int _label = domain->giveElement(number)->giveLabel();
198 
199  for ( Range &range: this->element_out ) {
200  if ( range.test(_label) ) {
201  selected = 1;
202  break;
203  }
204  }
205  }
206 
207  // if not selected exit
208  if ( !selected ) {
209  return 0;
210  }
211 
212  // if selected check exclude list
213  int _label = domain->giveElement(number)->giveLabel();
214 
215  for ( Range &range: element_except ) {
216  // test if excluded
217  if ( range.test(_label) ) {
218  return 0;
219  }
220  }
221 
222  // element not excluded;
223  return selected;
224 }
225 
226 int
228 {
229  if ( tstep_all_out_flag ) {
230  return 1;
231  }
232 
233  if ( tstep_step_out ) {
234  if ( ( ( tStep->giveNumber() - domain->giveEngngModel()->giveNumberOfFirstStep() ) % tstep_step_out ) == 0 ) {
235  return 1;
236  }
237  }
238 
239  for ( Range &range: this->tsteps_out ) {
240  // test if INCLUDED
241  if ( range.test( tStep->giveNumber() ) ) {
242  return 1;
243  }
244  }
245 
246  return 0;
247 }
248 
249 int
251 {
252  if ( testTimeStepOutput(tStep) ) {
253  if ( _testDofManOutput(num) ) {
254  return 1;
255  }
256  }
257 
258  return 0;
259 }
260 
261 int
263 {
264  if ( testTimeStepOutput(tStep) ) {
265  if ( _testElementOutput(num) ) {
266  return 1;
267  }
268  }
269 
270  return 0;
271 }
272 
273 void
275 {
277  this->tstep_step_out = om->tstep_step_out;
280 }
281 } // end namespace oofem
int testDofManOutput(int, TimeStep *)
Tests if given dof manager is required to do its output for given time step.
int element_all_out_flag
Indicates all elements are selected.
DofManager in active domain is shared only by remote elements (these are only introduced for nonlocal...
Definition: dofmanager.h:88
Domain * domain
Domain pointer.
Definition: outputmanager.h:85
Class and object Domain.
Definition: domain.h:115
#define _IFT_OutputManager_tstepall
Definition: outputmanager.h:48
#define _IFT_OutputManager_elementexcept
Definition: outputmanager.h:56
#define _IFT_OutputManager_dofmanoutput
Definition: outputmanager.h:53
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
int testElementOutput(int, TimeStep *)
Tests if given element is required to do its output for given time step.
int dofman_all_out_flag
Indicates all dofmanagers are selected.
Definition: outputmanager.h:94
std::list< Range > element_except
List of element numbers or their ranges being excluded.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
Represents output manager.
Definition: outputmanager.h:81
int giveNumberOfElements() const
Returns number of elements in domain.
Definition: domain.h:434
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
Definition: dofmanager.C:510
#define _IFT_OutputManager_dofmanall
Definition: outputmanager.h:50
#define _IFT_OutputManager_elementall
Definition: outputmanager.h:51
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: outputmanager.C:52
int tstep_step_out
User timeStep Output step. Indicates every tstep_step_out-th step selected.
Definition: outputmanager.h:89
std::list< Range > dofman_out
List of dofmanager numbers or their ranges being selected.
Definition: outputmanager.h:96
int _testElementOutput(int number)
Tests if given element is required to do its output.
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
Definition: element.C:759
std::list< Range > dofman_except
List of dofmanager numbers or their ranges being excluded.
Definition: outputmanager.h:98
int giveNumber()
Returns receiver&#39;s number.
Definition: timestep.h:129
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
void doElementOutput(FILE *, TimeStep *)
Does the element output.
Class Range is an abstraction for interval of integer numbers.
Definition: range.h:50
int giveLabel() const
Definition: dofmanager.h:502
std::list< Range > element_out
List of element numbers or their ranges being selected.
#define _IFT_OutputManager_tstepsout
Definition: outputmanager.h:52
int testTimeStepOutput(TimeStep *)
Tests if given time step output is required.
virtual int giveNumberOfFirstStep(bool force=false)
Returns number of first time step used by receiver.
Definition: engngm.h:730
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
Definition: element.h:1069
int _testDofManOutput(int number)
Tests if given dof manager is required to do its output.
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
#define _IFT_OutputManager_dofmanexcept
Definition: outputmanager.h:54
Class representing the general Input Record.
Definition: inputrecord.h:101
int tstep_all_out_flag
Indicates all steps selection.
Definition: outputmanager.h:87
OutputManager(Domain *d)
Creates empty Output Manager. By default all components are selected.
Definition: outputmanager.C:43
std::list< Range > tsteps_out
List of user selected step numbers.
Definition: outputmanager.h:91
#define _IFT_OutputManager_tstepstep
Definition: outputmanager.h:49
Element in active domain is only mirror of some remote element.
Definition: element.h:102
std::vector< std::unique_ptr< Element > > & giveElements()
Definition: domain.h:279
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
int giveLabel() const
Definition: element.h:1055
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
Definition: domain.C:314
void doDofManOutput(FILE *, TimeStep *)
Does the dofmanager output.
Definition: outputmanager.C:78
#define _IFT_OutputManager_elementoutput
Definition: outputmanager.h:55
void beCopyOf(OutputManager *om)
Receiver becomes shallow copy of the argument.
Class representing solution step.
Definition: timestep.h:80
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
Definition: dofmanager.h:512

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011