OOFEM 3.0
Loading...
Searching...
No Matches
usrdefboundaryload.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 "usrdefboundaryload.h"
36#include "function.h"
37#include "floatarray.h"
38#include "timestep.h"
39#include "dynamicinputrecord.h"
40#include "valuemodetype.h"
41#include "domain.h"
42#include "datastream.h"
43#include "contextioerr.h"
44#include "classfactory.h"
45
46namespace oofem {
48
49UsrDefBoundaryLoad :: UsrDefBoundaryLoad(int i, Domain * d) : BoundaryLoad(i, d) {
50}
51
52void
53UsrDefBoundaryLoad :: computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
54{
55 OOFEM_ERROR("not supported");
56}
57
58
59void
60UsrDefBoundaryLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
61{
62 // Evaluates the value at specific integration point
63 Function* f = domain->giveFunction(this->intensityFunction);
64 std :: map< std :: string, FunctionArgument > args = {
65 {"x", coords}
66 };
67 if ( mode == VM_Total ) {
68 args["t"] = FunctionArgument(tStep->giveTargetTime());
69 f->evaluate(answer, args);
70 return;
71 } else if (mode == VM_TotalIntrinsic) {
72 args["t"] = FunctionArgument(tStep->giveIntrinsicTime());
73 f->evaluate(answer, args);
74 return;
75 } else if (mode == VM_Incremental) {
76 FloatArray answerPrev;
77 args["t"] = FunctionArgument(tStep->giveTargetTime());
78 f->evaluate(answer, args);
79 args["t"] = FunctionArgument(tStep->giveTargetTime()-tStep->giveTimeIncrement());
80 f->evaluate(answerPrev, args);
81 answer.subtract(answerPrev);
82 return;
83 } else {
84 OOFEM_ERROR("unknown mode");
85 }
86}
87
88
89void
90UsrDefBoundaryLoad :: initializeFrom(InputRecord &ir)
91{
92 BoundaryLoad :: initializeFrom(ir);
93
95 int mgt = (int) SurfaceLoadBGT;
97 myGeomType = (bcGeomType) mgt;
99}
100
101
102void
103UsrDefBoundaryLoad :: giveInputRecord(DynamicInputRecord &input)
104{
105 BoundaryLoad :: giveInputRecord(input);
109}
110
111
112void
113UsrDefBoundaryLoad :: saveContext(DataStream &stream, ContextMode mode)
114{
115 BoundaryLoad :: saveContext(stream, mode);
116
117 if ( mode & CM_Definition ) {
118 if ( !stream.write(intensityFunction) ) {
120 }
121 if ( !stream.write(myGeomType) ) {
123 }
124 if ( !stream.write(approxOrder) ) {
126 }
127 }
128}
129
130
131void
132UsrDefBoundaryLoad :: restoreContext(DataStream &stream, ContextMode mode)
133{
134 BoundaryLoad :: restoreContext(stream, mode);
135
136 if ( mode & CM_Definition ) {
137 int _val;
138 if ( !stream.read(intensityFunction) ) {
140 }
141 if ( !stream.read(_val) ) {
143 }
144 myGeomType = (bcGeomType) _val;
145
146 if ( !stream.read(approxOrder) ) {
148 }
149 }
150}
151
152} // end namespace oofem
#define REGISTER_BoundaryCondition(class)
BoundaryLoad(int i, Domain *d)
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.
void setField(int item, InputFieldType id)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
void subtract(const FloatArray &src)
Definition floatarray.C:320
virtual double evaluate(TimeStep *tStep, ValueModeType mode)
Definition function.C:57
double giveTimeIncrement()
Returns solution step associated time increment.
Definition timestep.h:168
double giveTargetTime()
Returns target time.
Definition timestep.h:164
double giveIntrinsicTime()
Returns intrinsic time, e.g. time in which constitutive model is evaluated.
Definition timestep.h:166
bcGeomType myGeomType
bcgeotype of the boundary load
int intensityFunction
Reference to user defined function that computes the load intensity.
int approxOrder
approximation order to set up the appropriate integration rule
#define THROW_CIOERR(e)
#define CM_Definition
Definition contextmode.h:47
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
long ContextMode
Definition contextmode.h:43
bcGeomType
Type representing the geometric character of loading.
Definition bcgeomtype.h:40
@ SurfaceLoadBGT
Distributed surface load.
Definition bcgeomtype.h:45
@ CIO_IOERR
General IO error.
#define _IFT_UsrDefBoundaryLoad_GeomType
#define _IFT_UsrDefBoundaryLoad_approxorder
#define _IFT_UsrDefBoundaryLoad_intensityfunction

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