OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
stressstrainbasevector.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 "stressstrainbasevector.h"
36 #include "intarray.h"
37 #include "floatmatrix.h"
38 #include "error.h"
39 #include "datastream.h"
40 #include "materialmode.h"
41 #include "../sm/Materials/structuralmaterial.h"
42 #include "datastream.h"
43 
44 namespace oofem {
46 {
48  this->zero();
49  this->mode = m;
50 }
51 
53 {
55  OOFEM_ERROR( "The source has size %d and a new MaterialMode %s has reduced size %d", src.giveSize(), __MaterialModeToString(m), StructuralMaterial :: giveSizeOfVoigtSymVector(m) );
56  }
57 
58  this->mode = m;
59 }
60 
63 {
64  if ( this != & src ) { // beware of s=s;
65  this->values = src.values;
66  }
67 
68  this->mode = src.mode;
69  return * this;
70 }
71 
72 void
74 {
75  IntArray indx;
76  int answerSize = 6;
77 
78  if ( mode == _3dMat ) {
79  answer = * this;
80  return;
81  }
82 
83  answer.resize(answerSize);
84  answer.zero();
85 
87  answer.assemble(* this, indx);
88 }
89 
90 void
92 {
93  IntArray indx;
94 
95  if ( mode == _3dMat ) {
96  if ( this->giveSize() != 6 ) {
97  OOFEM_ERROR("full vector size mismatch");
98  }
99 
100  this->resize(6);
101  for ( int i = 1; i <= 6; i++ ) {
102  this->at(i) = vector.at(i);
103  }
104  } else {
107  this->zero();
108 
109  for ( int i = 1; i <= indx.giveSize(); i++ ) {
110  int j;
111  if ( ( j = indx.at(i) ) ) {
112  this->at(i) = vector.at(j);
113  }
114  }
115  }
116 }
117 
118 
121 {
122  contextIOResultType iores;
123  if ( ( iores = FloatArray :: storeYourself(stream) ) != CIO_OK ) {
124  return CIO_OK;
125  }
126 
127  // write material mode
128  if ( !stream.write((int)mode) ) {
129  return CIO_IOERR;
130  }
131 
132  return CIO_OK;
133 }
134 
137 {
138  contextIOResultType iores;
139  if ( ( iores = FloatArray :: restoreYourself(stream) ) != CIO_OK ) {
140  return iores;
141  }
142 
143  // read material mode
144  int val;
145  if ( !stream.read(val) ) {
146  return CIO_IOERR;
147  }
148  mode = (StressStrainMatMode)val;
149 
150  return CIO_OK;
151 }
152 
153 
154 void
156 {
157  this->mode = ( StressStrainMatMode ) newMode;
159  this->zero();
160 }
161 
162 void
164 //
165 //
166 // performs transformation of given vector to another system of axes,
167 // given by base.
168 // In base (FloatMatrix[3,3]) there are on each column stored vectors of
169 // coordinate system to which we do transformation. These vectors must
170 // be expressed in the same coordinate system as strainVector
171 // If transpose == 1 we transpose base matrix before transforming
172 //
173 
174 {
175  FloatMatrix tt;
176  FloatArray fullReceiver, fullAnswer;
177 
178  this->giveTranformationMtrx(tt, base, transpose);
179  // convert receiver to full mode
180  this->convertToFullForm(fullReceiver);
181  fullAnswer.beProductOf(tt, fullReceiver);
182  // convert back to reduced form
183  answer.convertFromFullForm( fullAnswer, this->giveStressStrainMode() );
184 }
185 
186 double
188 {
189  MaterialMode myMode = this->giveStressStrainMode();
190 
191  if ( myMode == _1dMat ) {
192  // 1D model
193  OOFEM_ERROR("No Split for 1D!");
194  return 0.0;
195  } else if ( myMode == _PlaneStress ) {
196  // plane stress problem
197  OOFEM_ERROR("No Split for plane stress!");
198  return 0.0;
199  } else {
200  // 3d, plane strain or axisymmetric problem
201  return ( this->at(1) + this->at(2) + this->at(3) ) / 3.0;
202  }
203 }
204 } // end namespace oofem
static int giveSizeOfVoigtSymVector(MaterialMode mmode)
Returns the size of symmetric part of a reduced stress/strain vector according to given mode...
static int giveVoigtSymVectorMask(IntArray &answer, MaterialMode mmode)
The same as giveVoigtVectorMask but returns a mask corresponding to a symmetric second order tensor...
std::vector< double > values
Stored values.
Definition: floatarray.h:86
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
contextIOResultType storeYourself(DataStream &stream) const
Definition: floatarray.C:872
StressStrainBaseVector(MaterialMode)
Constructor. Creates zero value stress/strain vector for given material mode.
MaterialMode giveStressStrainMode() const
Returns the material mode of receiver.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
void convertToFullForm(FloatArray &fullform) const
Computes the full form of receiver.
StressStrainMatMode mode
Stress strain mode.
General IO error.
contextIOResultType restoreYourself(DataStream &stream)
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
Base class for stress/strain vector representations.
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
const char * __MaterialModeToString(MaterialMode _value)
Definition: cltypes.C:314
double computeVolumetricPart() const
Returns the volumetric part of the vector.
#define OOFEM_ERROR(...)
Definition: error.h:61
contextIOResultType restoreYourself(DataStream &stream)
Definition: floatarray.C:895
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
StressStrainBaseVector & operator=(const StressStrainBaseVector &)
Assignment operator.
Class representing vector of real numbers.
Definition: floatarray.h:82
void transformTo(StressStrainBaseVector &answer, const FloatMatrix &base, int transpose=0) const
Transforms receiver vector into another coordinate system.
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void assemble(const FloatArray &fe, const IntArray &loc)
Assembles the array fe (typically, the load vector of a finite element) into the receiver, using loc as location array.
Definition: floatarray.C:551
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
contextIOResultType storeYourself(DataStream &stream)
void convertFromFullForm(const FloatArray &reducedform, MaterialMode mode)
Assign to receiver the reduced form of given vector.
virtual void giveTranformationMtrx(FloatMatrix &answer, const FloatMatrix &base, int transpose=0) const =0
Computes 3d transformation matrix from standard vector transformation matrix.
int giveSize() const
Definition: intarray.h:203
MaterialMode StressStrainMatMode
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
void letStressStrainModeBe(const MaterialMode newMode)
Changes the material mode of receiver.
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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:31 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011