libsurf
Programmer's Documentation

nstelementstress.h (r6227/r5718)
1 
2 /* Copyright (C) 2015 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_NSTELEMENTSTRESS_H
16 #define SURF_NSTELEMENTSTRESS_H
17 
18 #include "forward.h"
19 #include <boost/regex.hpp>
20 #include <cstring>
21 
31 {
32 private:
33 
34  enum { MaxComp = 32 };
35 
36 public:
37 
39  enum Class { Unknown, LinearShell, CompositeShell, Solid };
40 
42  void compile(uint icode);
43 
45  bool setup(uint icode) {
46  const uint supported[] = {33, 67, 68, 74, 95, 96, 97,
47  227, 228, 232, 233, 255};
48  const uint ncodes = sizeof(supported) / sizeof(supported[0]);
49  itemCode = icode;
50  eid = 0;
51  laminateIndex = 1;
52  gid = 0;
53  stage = 0;
54  ipoint = 0;
55  npoints = 0;
56  memset(sigma, 0, sizeof(sigma));
57  return std::binary_search(supported, supported+ncodes, icode);
58  }
59 
61  uint process(const std::string &ln);
62 
64  static int elementClass(uint ic) {
65  if (isLinearShell(ic))
66  return LinearShell;
67  else if (isCompositeShell(ic))
68  return CompositeShell;
69  else if (isSolid(ic))
70  return Solid;
71  return Unknown;
72  }
73 
75  static bool isLinearShell(uint ic) {
76  const uint codes[] = {33,74,227,228};
77  const uint *end = codes + sizeof(codes)/sizeof(codes[0]);
78  return std::find(codes, end, ic) != end;
79  }
80 
82  static bool isCompositeShell(uint ic) {
83  const uint codes[] = {95,96,97,232,233};
84  const uint *end = codes + sizeof(codes)/sizeof(codes[0]);
85  return std::find(codes, end, ic) != end;
86  }
87 
89  static bool isShell(uint ic) {
90  return isLinearShell(ic) or isCompositeShell(ic);
91  }
92 
94  static bool isSolid(uint ic) {
95  const uint codes[] = {39,67,68,255};
96  const uint *end = codes + sizeof(codes)/sizeof(codes[0]);
97  return std::find(codes, end, ic) != end;
98  }
99 
101  float sigma[MaxComp];
102 
104  uint itemCode;
105 
107  uint eid;
108 
111 
113  uint gid;
114 
115 private:
116 
118  uint process33(const std::string &ln);
119 
121  uint process95(const std::string &ln);
122 
124  uint process67(const std::string &ln);
125 
126 private:
127 
129  uint stage;
130 
132  uint npoints, ipoint;
133 
135  boost::regex pattern[8];
136 
138  boost::smatch matches;
139 };
140 
141 #endif // NSTELEMENTSTRESS_H
uint process95(const std::string &ln)
fetch data from next line, return state 0 if set complete
Definition: nstelementstress.cpp:146
uint stage
internal state counter
Definition: nstelementstress.h:129
void compile(uint icode)
setup to process stress items of a certain code
Definition: nstelementstress.cpp:21
static bool isCompositeShell(uint ic)
type characterization
Definition: nstelementstress.h:82
uint process(const std::string &ln)
fetch data from next line, return state 0 if set complete
Definition: nstelementstress.cpp:94
Nastran element stress record.
Definition: nstelementstress.h:30
uint laminateIndex
ply identifier for composite elements
Definition: nstelementstress.h:110
static int elementClass(uint ic)
return element class identifier
Definition: nstelementstress.h:64
uint npoints
number of points to expect (CHEXA)
Definition: nstelementstress.h:132
uint process33(const std::string &ln)
fetch data from next line, return state 0 if set complete
Definition: nstelementstress.cpp:106
Class
element class
Definition: nstelementstress.h:39
float sigma[MaxComp]
stress components
Definition: nstelementstress.h:101
uint itemCode
item code identifies type of stress data recovered
Definition: nstelementstress.h:104
boost::regex pattern[8]
regular expressions to use
Definition: nstelementstress.h:135
static bool isShell(uint ic)
type characterization
Definition: nstelementstress.h:89
uint process67(const std::string &ln)
fetch data from next line, return state 0 if set complete
Definition: nstelementstress.cpp:208
static bool isSolid(uint ic)
type characterization
Definition: nstelementstress.h:94
static bool isLinearShell(uint ic)
type characterization
Definition: nstelementstress.h:75
boost::smatch matches
regex matches
Definition: nstelementstress.h:138
uint eid
element id
Definition: nstelementstress.h:107
uint gid
node gid for solid elements
Definition: nstelementstress.h:113
bool setup(uint icode)
reset to starting condition, return whether reading item code is supported
Definition: nstelementstress.h:45
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5