OOFEM 3.0
Loading...
Searching...
No Matches
randommaterialext.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 "gausspoint.h"
36#include "inputrecord.h"
37#include "domain.h"
38#include "material.h"
39#include "function.h"
40#include "randommaterialext.h"
41#include "dynamicinputrecord.h"
42
43namespace oofem {
44bool
45RandomMaterialStatusExtensionInterface :: _giveProperty(int key, double &value)
46{
47 if ( randProperties.includes(key) ) {
48 value = randProperties.at(key);
49 return true;
50 } else {
51 return false;
52 }
53}
54
55void
56RandomMaterialStatusExtensionInterface :: _setProperty(int key, double value)
57{
58 randProperties.at(key) = value;
59}
60
61
62void
63RandomMaterialExtensionInterface :: initializeFrom(InputRecord &ir)
64{
65 randVariables.clear();
69
70 if ( randVariables.giveSize() != randomVariableGenerators.giveSize() ) {
71 throw ValueInputException(ir, _IFT_RandomMaterialExt_randVariables, "Incompatible size of randvars and randdist attrs");
72 }
73}
74
75
76void
77RandomMaterialExtensionInterface :: giveInputRecord(DynamicInputRecord &ir)
78{
81}
82
83
84bool
85RandomMaterialExtensionInterface :: give(int key, GaussPoint *gp, double &value) const
86{
87 MaterialStatus *status = static_cast< MaterialStatus * >( gp->giveMaterialStatus() );
88
89 // check if random material status has been initialized - does not have to be if material is used as a dummy
91 return false;
92 }
93
94
97 return interface->_giveProperty(key, value);
98}
99
100void
101RandomMaterialExtensionInterface :: _generateStatusVariables(GaussPoint *gp) const
102{
103 // Have to wrap it through the material to ensure that it gets an actual material status (for now at least)
104 int size = randVariables.giveSize();
105 double value;
106 MaterialStatus *matStat = static_cast< MaterialStatus * >( gp->giveMaterialStatus() );
109
110 for ( int i = 1; i <= size; i++ ) {
111 FloatArray globalCoordinates;
112 if ( gp->giveElement()->computeGlobalCoordinates(globalCoordinates, gp->giveSubPatchCoordinates() ) ) {
114 value = f->evaluate({{ "x", globalCoordinates } });
115 status->_setProperty(randVariables.at(i), value);
116 } else {
117 OOFEM_ERROR("computeGlobalCoordinates failed");
118 }
119 }
120}
121} // end namespace oofem
Function * giveFunction(int n)
Definition domain.C:271
void setField(int item, InputFieldType id)
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Definition element.C:1225
Domain * giveDomain() const
Definition femcmpnn.h:97
virtual double evaluate(TimeStep *tStep, ValueModeType mode)
Definition function.C:57
const FloatArray & giveSubPatchCoordinates() const
Returns local sub-patch coordinates of the receiver.
Definition gausspoint.h:142
IntegrationPointStatus * giveMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default)
Definition gausspoint.h:204
Element * giveElement()
Returns corresponding element to receiver.
Definition gausspoint.h:187
virtual Interface * giveInterface(InterfaceType t)
IntArray randomVariableGenerators
Array of generators id's for corresponding randomized variables.
IntArray randVariables
Array of randomized variables (identified by a key).
Dictionary randProperties
Dictionary containing material model values.
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
@ RandomMaterialStatusExtensionInterfaceType
#define _IFT_RandomMaterialExt_randVariables
#define _IFT_RandomMaterialExt_randGen

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