OOFEM 3.0
Loading...
Searching...
No Matches
assemblercallback.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 "assemblercallback.h"
36#include "floatarray.h"
37#include "floatmatrix.h"
38#include "element.h"
39#include "dofmanager.h"
40#include "activebc.h"
41
42#include "nodalload.h"
43#include "bodyload.h"
44#include "boundaryload.h"
45
46namespace oofem {
47
48void VectorAssembler :: vectorFromElement(FloatArray& vec, Element& element, TimeStep* tStep, ValueModeType mode) const { vec.clear(); }
49
50void VectorAssembler :: vectorFromLoad(FloatArray& vec, Element& element, BodyLoad* load, TimeStep* tStep, ValueModeType mode) const { vec.clear(); }
51
52void VectorAssembler :: vectorFromSurfaceLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep, ValueModeType mode) const { vec.clear(); }
53
54void VectorAssembler :: vectorFromEdgeLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep, ValueModeType mode) const { vec.clear(); }
55
56void VectorAssembler :: vectorFromNodeLoad(FloatArray& vec, DofManager& dman, NodalLoad* load, TimeStep* tStep, ValueModeType mode) const { vec.clear(); }
57
58void VectorAssembler :: assembleFromActiveBC(FloatArray &answer, ActiveBoundaryCondition &bc, TimeStep* tStep, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorms, void* lock) const { }
59
60void VectorAssembler :: locationFromElement(IntArray& loc, Element& element, const UnknownNumberingScheme& s, IntArray* dofIds) const
61{
62 element.giveLocationArray(loc, s, dofIds);
63}
64
65void VectorAssembler :: locationFromElementNodes(IntArray& loc, Element& element, const IntArray& bNodes, const UnknownNumberingScheme& s, IntArray* dofIds) const
66{
67 element.giveBoundaryLocationArray(loc, bNodes, s, dofIds);
68}
69
70void MatrixAssembler :: matrixFromElement(FloatMatrix& mat, Element& element, TimeStep* tStep) const { mat.clear(); }
71
72void MatrixAssembler :: matrixFromLoad(FloatMatrix& mat, Element& element, BodyLoad* load, TimeStep* tStep) const { mat.clear(); }
73
74void MatrixAssembler :: matrixFromSurfaceLoad(FloatMatrix& mat, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep) const { mat.clear(); }
75
76void MatrixAssembler :: matrixFromEdgeLoad(FloatMatrix& mat, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep) const { mat.clear(); }
77
78void MatrixAssembler :: assembleFromActiveBC(SparseMtrx &k, ActiveBoundaryCondition &bc, TimeStep* tStep, const UnknownNumberingScheme &s_r, const UnknownNumberingScheme &s_c, void *lock) const {}
79
80void MatrixAssembler :: locationFromElement(IntArray& loc, Element& element, const UnknownNumberingScheme& s, IntArray* dofIds) const
81{
82 element.giveLocationArray(loc, s, dofIds);
83}
84
85void MatrixAssembler :: locationFromElementNodes(IntArray& loc, Element& element, const IntArray& bNodes, const UnknownNumberingScheme& s, IntArray* dofIds) const
86{
87 element.giveBoundaryLocationArray(loc, bNodes, s, dofIds);
88}
89
90
91void MatrixProductAssembler :: vectorFromElement(FloatArray& vec, Element& element, TimeStep* tStep, ValueModeType mode) const
92{
93 FloatMatrix mat;
94 FloatArray r;
95 this->mAssem.matrixFromElement(mat, element, tStep);
96 element.computeVectorOf(mode, tStep, r);
97 vec.beProductOf(mat, r);
98}
99
100void MatrixProductAssembler :: vectorFromLoad(FloatArray& vec, Element& element, BodyLoad* load, TimeStep* tStep, ValueModeType mode) const
101{
102 FloatMatrix mat;
103 this->mAssem.matrixFromLoad(mat, element, load, tStep);
104 //vec.beProductOf(mat, this->vec);
105}
106
107void MatrixProductAssembler :: vectorFromSurfaceLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep, ValueModeType mode) const
108{
109 FloatMatrix mat;
110 this->mAssem.matrixFromSurfaceLoad(mat, element, load, boundary, tStep);
111 //vec.beProductOf(mat, this->vec);
112}
113
114void MatrixProductAssembler :: vectorFromEdgeLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep, ValueModeType mode) const
115{
116 FloatMatrix mat;
117 this->mAssem.matrixFromEdgeLoad(mat, element, load, edge, tStep); // ??????
118 //vec.beProductOf(mat, this->vec);
119}
120
121
122void InternalForceAssembler :: vectorFromElement(FloatArray& vec, Element& element, TimeStep* tStep, ValueModeType mode) const
123{
124 element.giveCharacteristicVector(vec, InternalForcesVector, mode, tStep);
125 //element.computeInternalForces(vec, tStep);
126}
127
128void InternalForceAssembler :: vectorFromLoad(FloatArray& vec, Element& element, BodyLoad* load, TimeStep* tStep, ValueModeType mode) const
129{
130 element.computeLoadVector(vec, load, InternalForcesVector, mode, tStep);
131 //element.computeInternalForcesFromLoad(vec, load, tStep);
132}
133
134void InternalForceAssembler :: vectorFromSurfaceLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep, ValueModeType mode) const
135{
136 element.computeBoundarySurfaceLoadVector(vec, load, boundary, InternalForcesVector, mode, tStep);
137 //element.computeInternalForcesFromBoundaryLoad(vec, load, boundary, tStep);
138}
139
140void InternalForceAssembler :: vectorFromEdgeLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep, ValueModeType mode) const
141{
142 element.computeBoundaryEdgeLoadVector(vec, load, edge, InternalForcesVector, mode, tStep);
143 //element.computeInternalForcesFromEdgeLoad(vec, load, edge, tStep);
144}
145
146void InternalForceAssembler :: assembleFromActiveBC(FloatArray &answer, ActiveBoundaryCondition &bc, TimeStep* tStep, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorms, void* lock) const
147{
148 bc.assembleVector(answer, tStep, InternalForcesVector, mode, s, eNorms, lock);
149 //bc.assembleInternalForces(answer, tStep, s, eNorms);
150}
151
152
153void ExternalForceAssembler :: vectorFromElement(FloatArray& vec, Element& element, TimeStep* tStep, ValueModeType mode) const
154{
156 element.giveCharacteristicVector(vec, ExternalForcesVector, mode, tStep);
157}
158
159void ExternalForceAssembler :: vectorFromLoad(FloatArray& vec, Element& element, BodyLoad* load, TimeStep* tStep, ValueModeType mode) const
160{
161 vec.clear();
162 if ( ! load->reference )
163 element.computeLoadVector(vec, load, ExternalForcesVector, mode, tStep);
164 //element.computeExternalForcesFromLoad(vec, load, tStep);
165}
166
167void ExternalForceAssembler :: vectorFromSurfaceLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep, ValueModeType mode) const
168{
169 vec.clear();
170 if ( ! load->reference )
171 element.computeBoundarySurfaceLoadVector(vec, load, boundary, ExternalForcesVector, mode, tStep);
172 //element.computeExternalForcesFromSurfaceLoad(vec, load, boundary, tStep);
173}
174
175void ExternalForceAssembler :: vectorFromEdgeLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep, ValueModeType mode) const
176{
177 vec.clear();
178 if ( ! load->reference )
179 element.computeBoundaryEdgeLoadVector(vec, load, edge, ExternalForcesVector, mode, tStep);
180 //element.computeExternalForcesFromEdgeLoad(vec, load, edge, tStep);
181}
182
183void ExternalForceAssembler :: vectorFromNodeLoad(FloatArray& vec, DofManager& dman, NodalLoad* load, TimeStep* tStep, ValueModeType mode) const
184{
185 vec.clear();
186 if ( ! load->reference )
187 dman.computeLoadVector(vec, load, ExternalForcesVector, tStep, mode);
188 //dman.computeExternalForcesFromLoad(vec, load, tStep);
189}
190
191void ExternalForceAssembler :: assembleFromActiveBC(FloatArray &answer, ActiveBoundaryCondition &bc, TimeStep* tStep, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorms, void* lock) const
192{
193 bc.assembleVector(answer, tStep, ExternalForcesVector, mode, s, eNorms, lock);
194 //bc.assembleExternalForces(answer, tStep, s, eNorms);
195}
196
197
198void ReferenceForceAssembler :: vectorFromLoad(FloatArray& vec, Element& element, BodyLoad* load, TimeStep* tStep, ValueModeType mode) const
199{
200 vec.clear();
201 if ( load->reference )
202 element.computeLoadVector(vec, load, ExternalForcesVector, mode, tStep);
203 //element.computeExternalForcesFromLoad(vec, load, tStep);
204}
205
206
207void ReferenceForceAssembler :: vectorFromSurfaceLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep, ValueModeType mode) const
208{
209 vec.clear();
210 if ( load->reference )
211 element.computeBoundarySurfaceLoadVector(vec, load, boundary, ExternalForcesVector, mode, tStep);
212 //element.computeExternalForcesFromBoundaryLoad(vec, load, boundary, tStep);
213}
214
215void ReferenceForceAssembler :: vectorFromEdgeLoad(FloatArray& vec, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep, ValueModeType mode) const
216{
217 vec.clear();
218 if ( load->reference )
219 element.computeBoundaryEdgeLoadVector(vec, load, edge, ExternalForcesVector, mode, tStep);
220 //element.computeExternalForcesFromEdgeLoad(vec, load, edge, tStep);
221}
222
223void ReferenceForceAssembler :: vectorFromNodeLoad(FloatArray& vec, DofManager& dman, NodalLoad* load, TimeStep* tStep, ValueModeType mode) const
224{
225 vec.clear();
226 if ( load->reference )
227 dman.computeLoadVector(vec, load, ExternalForcesVector, tStep, mode);
228 //dman.computeExternalForcesFromLoad(vec, load, tStep);
229}
230
231
232void LumpedMassVectorAssembler :: vectorFromElement(FloatArray& vec, Element& element, TimeStep* tStep, ValueModeType mode) const
233{
234 element.giveCharacteristicVector(vec, LumpedMassMatrix, mode, tStep);
235 //element.computeLumpedMassMatrix(vec, tStep);
236}
237
238
239void InertiaForceAssembler :: vectorFromElement(FloatArray& vec, Element& element, TimeStep* tStep, ValueModeType mode) const
240{
241 element.giveCharacteristicVector(vec, InertiaForcesVector, mode, tStep);
242 //element.computeInertiaForces(vec, tStep);
243}
244
245
246void TangentAssembler :: matrixFromElement(FloatMatrix& mat, Element& element, TimeStep* tStep) const
247{
248 if ( this->rmode == TangentStiffness ) {
249 element.giveCharacteristicMatrix(mat, TangentStiffnessMatrix, tStep);
250 } else if ( this->rmode == ElasticStiffness ) {
251 element.giveCharacteristicMatrix(mat, ElasticStiffnessMatrix, tStep);
252 } else if ( this->rmode == SecantStiffness ) {
253 element.giveCharacteristicMatrix(mat, SecantStiffnessMatrix, tStep);
254 }
255 //element.computeTangentMatrix(mat, this->rmode, tStep);
256}
257
258void TangentAssembler :: matrixFromLoad(FloatMatrix& mat, Element& element, BodyLoad* load, TimeStep* tStep) const
259{
260 mat.clear();
261 //element.computeTangentFromLoad(mat, load, this->rmode, tStep);
262}
263
264void TangentAssembler :: matrixFromSurfaceLoad(FloatMatrix& mat, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep) const
265{
266 element.computeTangentFromSurfaceLoad(mat, load, boundary, this->rmode, tStep);
267}
268
269void TangentAssembler :: matrixFromEdgeLoad(FloatMatrix& mat, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep) const
270{
271 //mat.clear();
272 element.computeTangentFromEdgeLoad(mat, load, edge, this->rmode, tStep);
273}
274
275void TangentAssembler :: assembleFromActiveBC(SparseMtrx &k, ActiveBoundaryCondition &bc, TimeStep* tStep, const UnknownNumberingScheme &s_r, const UnknownNumberingScheme &s_c, void *lock) const
276{
277 bc.assemble(k, tStep, TangentStiffnessMatrix, s_r, s_c, 1.0, lock);
278}
279
280
281
282void MassMatrixAssembler :: matrixFromElement(FloatMatrix& mat, Element& element, TimeStep* tStep) const
283{
284 element.giveCharacteristicMatrix(mat, MassMatrix, tStep);
285 //element.computeMassMatrix(mat, tStep);
286}
287
288
289
290EffectiveTangentAssembler :: EffectiveTangentAssembler(MatResponseMode mode, bool lumped, double k, double m) :
291 MatrixAssembler(), rmode(mode), lumped(lumped), k(k), m(m)
292{}
293
294void EffectiveTangentAssembler :: matrixFromElement(FloatMatrix &answer, Element &el, TimeStep *tStep) const
295{
296 FloatMatrix massMatrix;
297
298 if ( this->rmode == TangentStiffness ) {
299 el.giveCharacteristicMatrix(answer, TangentStiffnessMatrix, tStep);
300 } else if ( this->rmode == ElasticStiffness ) {
301 el.giveCharacteristicMatrix(answer, ElasticStiffnessMatrix, tStep);
302 } else if ( this->rmode == SecantStiffness ) {
303 el.giveCharacteristicMatrix(answer, SecantStiffnessMatrix, tStep);
304 }
305 //element.computeTangentMatrix(answer, this->rmode, tStep);
306 answer.times(this->k);
307
308 el.giveCharacteristicMatrix(massMatrix, this->lumped ? LumpedMassMatrix : MassMatrix, tStep);
309 answer.add(this->m, massMatrix);
310}
311
312void EffectiveTangentAssembler :: matrixFromLoad(FloatMatrix& mat, Element& element, BodyLoad* load, TimeStep* tStep) const
313{
314 mat.clear();
315 //element.computeTangentFromLoad(mat, load, this->rmode, tStep);
316 //mat.times(this->k);
317}
318
319void EffectiveTangentAssembler :: matrixFromSurfaceLoad(FloatMatrix& mat, Element& element, BoundaryLoad* load, int boundary, TimeStep* tStep) const
320{
321 element.computeTangentFromSurfaceLoad(mat, load, boundary, this->rmode, tStep);
322 mat.times(this->k);
323}
324
325void EffectiveTangentAssembler :: matrixFromEdgeLoad(FloatMatrix& mat, Element& element, BoundaryLoad* load, int edge, TimeStep* tStep) const
326{
327 mat.clear();
328 element.computeTangentFromEdgeLoad(mat, load, edge, this->rmode, tStep);
329 mat.times(this->k);
330}
331
332void EffectiveTangentAssembler :: assembleFromActiveBC(SparseMtrx &k, ActiveBoundaryCondition &bc, TimeStep* tStep, const UnknownNumberingScheme &s_r, const UnknownNumberingScheme &s_c, void* lock) const
333{
334 // TODO: Crucial part to add: We have to support a scaling factor for this method to support effective tangents.
335 bc.assemble(k, tStep, TangentStiffnessMatrix, s_r, s_c, this->k, lock);
336}
337
338
339}
virtual void assembleVector(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorms=nullptr, void *lock=nullptr)
Definition activebc.h:121
virtual void assemble(SparseMtrx &answer, TimeStep *tStep, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s, double scale=1.0, void *lock=nullptr)
Definition activebc.h:107
virtual void computeLoadVector(FloatArray &answer, Load *load, CharType type, TimeStep *tStep, ValueModeType mode)
Definition dofmanager.C:105
virtual void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep)
Definition element.C:620
virtual void giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIds=NULL)
Definition element.C:485
virtual void giveCharacteristicVector(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep)
Definition element.C:631
void giveLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s, IntArray *dofIds=NULL) const
Definition element.C:429
virtual void computeTangentFromSurfaceLoad(FloatMatrix &answer, BoundaryLoad *load, int boundary, MatResponseMode rmode, TimeStep *tStep)
Definition element.C:657
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Definition element.C:103
virtual void computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep)
Definition element.C:641
virtual void computeBoundarySurfaceLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true)
Definition element.C:649
virtual void computeTangentFromEdgeLoad(FloatMatrix &answer, BoundaryLoad *load, int boundary, MatResponseMode rmode, TimeStep *tStep)
Definition element.C:663
virtual void computeBoundaryEdgeLoadVector(FloatArray &answer, BoundaryLoad *load, int edge, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true)
Definition element.C:669
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void times(double f)
void add(const FloatMatrix &a)
*Sets size of receiver to be an empty matrix It will have zero rows and zero columns size void clear()
bool reference
Definition load.h:101
const MatrixAssembler & mAssem

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