www.mooseframework.org
SymmTensor.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "SymmTensor.h"
8 
9 std::ostream &
10 operator<<(std::ostream & stream, const SymmTensor & obj)
11 {
12  stream << "SymmTensor:\n"
13  << std::setprecision(6) << std::setw(13) << obj._xx << "\t" << std::setw(13) << obj._xy
14  << "\t" << std::setw(13) << obj._zx << "\n"
15  << "\t\t" << std::setw(13) << obj._yy << "\t" << std::setw(13) << obj._yz << "\n"
16  << "\t\t\t\t" << std::setw(13) << obj._zz << std::endl;
17  return stream;
18 }
19 
20 template <>
21 PropertyValue *
22 MaterialProperty<SymmTensor>::init(int size)
23 {
24  MaterialProperty<SymmTensor> * copy = new MaterialProperty<SymmTensor>;
25  copy->_value.resize(size);
26  for (unsigned int i(0); i < static_cast<unsigned>(size); ++i)
27  (*copy)[i].zero();
28  return copy;
29 }
30 
31 template <>
32 void
33 dataStore(std::ostream & stream, const SymmTensor & v, void * /*context*/)
34 {
35  Real r;
36  r = v.xx();
37  stream.write((const char *)&r, sizeof(r));
38  r = v.yy();
39  stream.write((const char *)&r, sizeof(r));
40  r = v.zz();
41  stream.write((const char *)&r, sizeof(r));
42  r = v.xy();
43  stream.write((const char *)&r, sizeof(r));
44  r = v.yz();
45  stream.write((const char *)&r, sizeof(r));
46  r = v.zx();
47  stream.write((const char *)&r, sizeof(r));
48 }
49 
50 template <>
51 void
52 dataLoad(std::istream & stream, SymmTensor & v, void * /*context*/)
53 {
54  Real r = 0.;
55  stream.read((char *)&r, sizeof(r));
56  v.xx(r);
57  stream.read((char *)&r, sizeof(r));
58  v.yy(r);
59  stream.read((char *)&r, sizeof(r));
60  v.zz(r);
61  stream.read((char *)&r, sizeof(r));
62  v.xy(r);
63  stream.read((char *)&r, sizeof(r));
64  v.yz(r);
65  stream.read((char *)&r, sizeof(r));
66  v.zx(r);
67 }
Real yy() const
Definition: SymmTensor.h:130
Real xx() const
Definition: SymmTensor.h:129
Real zz() const
Definition: SymmTensor.h:131
void dataLoad(std::istream &stream, SymmTensor &v, void *)
Definition: SymmTensor.C:52
Real xy() const
Definition: SymmTensor.h:132
Real yz() const
Definition: SymmTensor.h:133
std::ostream & operator<<(std::ostream &stream, const SymmTensor &obj)
Definition: SymmTensor.C:10
Real zx() const
Definition: SymmTensor.h:134
void dataStore(std::ostream &stream, const SymmTensor &v, void *)
Definition: SymmTensor.C:33