OOFEM 3.0
Loading...
Searching...
No Matches
eigenvectorprimaryfield.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
36#include "timestep.h"
37#include "domain.h"
38#include "dofmanager.h"
39#include "dof.h"
40#include "floatarray.h"
41#include "floatmatrix.h"
42#include "engngm.h"
43#include "set.h"
44#include "boundarycondition.h"
45#include "initialcondition.h"
46#include "element.h"
47#include "activebc.h"
48
49
50namespace oofem {
51EigenVectorPrimaryField :: EigenVectorPrimaryField(EngngModel *a, int idomain, FieldType ft, int nHist):
52 DofDistributedPrimaryField(a, idomain, ft, nHist)
53{ }
54
55
56EigenVectorPrimaryField :: ~EigenVectorPrimaryField()
57{ }
58
59
60double
61EigenVectorPrimaryField :: giveUnknownValue(Dof *dof, ValueModeType mode, TimeStep *tStep)
62{
63 if ( mode != VM_Total ) OOFEM_ERROR("Only VM_Total is applicable to eigen vector fields");
64 return dof->giveUnknownsDictionaryValue(tStep, mode);
65}
66
67
68void
69EigenVectorPrimaryField :: updateAll(const FloatMatrix &eigenVectors, const UnknownNumberingScheme &s)
70{
71 Domain *d = emodel->giveDomain(domainIndx);
72
73 for (int i = 1; i <= eigenVectors.giveNumberOfColumns(); ++i ) {
74 TimeStep step(i, nullptr, 0, 1.0, 0.0, 0);
75 this->applyBoundaryCondition(&step);
76 }
77
78 auto set_values = [&eigenVectors, &s](DofManager &dman) {
79 for ( Dof *dof: dman ) {
80 if ( !dof->isPrimaryDof() ) continue;
81 int eqNum = dof->giveEquationNumber(s);
82 if ( eqNum > 0 ) {
83 for (int i = 1; i <= eigenVectors.giveNumberOfColumns(); ++i ) {
84 // updateUnknownsDict should be changed to let the field have direct input rather than calling such a method.
85 // Until then, we "fake" a time step, relying on the fact that only the time-step number matters here.
86 TimeStep step(i, nullptr, 0, 1.0, 0.0, 0);
87 dof->updateUnknownsDictionary(&step, VM_Total, eigenVectors.at(eqNum, i));
88 }
89 }
90 }
91 };
92
93 for ( auto &node : d->giveDofManagers() ) {
94 set_values(*node);
95 }
96
97 for ( auto &elem : d->giveElements() ) {
98 int ndman = elem->giveNumberOfInternalDofManagers();
99 for ( int i = 1; i <= ndman; i++ ) {
100 set_values(*elem->giveInternalDofManager(i));
101 }
102 }
103
104 for ( auto &bc : d->giveBcs() ) {
105 int ndman = bc->giveNumberOfInternalDofManagers();
106 for ( int i = 1; i <= ndman; i++ ) {
107 set_values(*bc->giveInternalDofManager(i));
108 }
109 }
110}
111
112
113void
114EigenVectorPrimaryField :: applyDefaultInitialCondition()
115{ }
116
117
118void
119EigenVectorPrimaryField :: advanceSolution(TimeStep *tStep)
120{ }
121
122} // end namespace oofem
virtual double giveUnknownsDictionaryValue(TimeStep *tStep, ValueModeType mode)
Definition dof.h:373
std ::vector< std ::unique_ptr< DofManager > > & giveDofManagers()
Definition domain.h:427
std ::vector< std ::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
Definition domain.h:349
std ::vector< std ::unique_ptr< Element > > & giveElements()
Definition domain.h:294
int giveNumberOfColumns() const
Returns number of columns of receiver.
double at(std::size_t i, std::size_t j) const
#define OOFEM_ERROR(...)
Definition error.h:79
FieldType
Physical type of field.
Definition field.h:64

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