1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 #include "UNV2412_Structure.hxx"
27 #include "UNV_Utilities.hxx"
31 using namespace UNV2412;
33 // Universal Dataset Number 2412
38 // Revision Date: 14-AUG-1992
39 // -----------------------------------------------------------------------
41 // Record 1: FORMAT(6I10)
42 // Field 1 -- element label
43 // Field 2 -- fe descriptor id
44 // Field 3 -- physical property table number
45 // Field 4 -- material property table number
47 // Field 6 -- number of nodes on element
49 // Record 2: *** FOR NON-BEAM ELEMENTS ***
51 // Fields 1-n -- node labels defining element
53 // Record 2: *** FOR BEAM ELEMENTS ONLY ***
55 // Field 1 -- beam orientation node number
56 // Field 2 -- beam fore-end cross section number
57 // Field 3 -- beam aft-end cross section number
59 // Record 3: *** FOR BEAM ELEMENTS ONLY ***
61 // Fields 1-n -- node labels defining element
63 // Records 1 and 2 are repeated for each non-beam element in the model.
64 // Records 1 - 3 are repeated for each beam element in the model.
82 // 22 25 29 30 31 26 24 23
85 // 36 116 16 5380 7 20
86 // 152 159 168 167 166 158 150 151
87 // 154 170 169 153 157 161 173 172
91 // FE Descriptor Id definitions
92 // ____________________________
101 // 41 Plane Stress Linear Triangle
102 // 42 Plane Stress Parabolic Triangle
103 // 43 Plane Stress Cubic Triangle
104 // 44 Plane Stress Linear Quadrilateral
105 // 45 Plane Stress Parabolic Quadrilateral
106 // 46 Plane Strain Cubic Quadrilateral
107 // 51 Plane Strain Linear Triangle
108 // 52 Plane Strain Parabolic Triangle
109 // 53 Plane Strain Cubic Triangle
110 // 54 Plane Strain Linear Quadrilateral
111 // 55 Plane Strain Parabolic Quadrilateral
112 // 56 Plane Strain Cubic Quadrilateral
113 // 61 Plate Linear Triangle
114 // 62 Plate Parabolic Triangle
115 // 63 Plate Cubic Triangle
116 // 64 Plate Linear Quadrilateral
117 // 65 Plate Parabolic Quadrilateral
118 // 66 Plate Cubic Quadrilateral
119 // 71 Membrane Linear Quadrilateral
120 // 72 Membrane Parabolic Triangle
121 // 73 Membrane Cubic Triangle
122 // 74 Membrane Linear Triangle
123 // 75 Membrane Parabolic Quadrilateral
124 // 76 Membrane Cubic Quadrilateral
125 // 81 Axisymmetric Solid Linear Triangle
126 // 82 Axisymmetric Solid Parabolic Triangle
127 // 84 Axisymmetric Solid Linear Quadrilateral
128 // 85 Axisymmetric Solid Parabolic Quadrilateral
129 // 91 Thin Shell Linear Triangle
130 // 92 Thin Shell Parabolic Triangle
131 // 93 Thin Shell Cubic Triangle
132 // 94 Thin Shell Linear Quadrilateral
133 // 95 Thin Shell Parabolic Quadrilateral
134 // 96 Thin Shell Cubic Quadrilateral
135 // 101 Thick Shell Linear Wedge
136 // 102 Thick Shell Parabolic Wedge
137 // 103 Thick Shell Cubic Wedge
138 // 104 Thick Shell Linear Brick
139 // 105 Thick Shell Parabolic Brick
140 // 106 Thick Shell Cubic Brick
141 // 111 Solid Linear Tetrahedron
142 // 112 Solid Linear Wedge
143 // 113 Solid Parabolic Wedge
144 // 114 Solid Cubic Wedge
145 // 115 Solid Linear Brick
146 // 116 Solid Parabolic Brick
147 // 117 Solid Cubic Brick
148 // 118 Solid Parabolic Tetrahedron
151 // 136 Node To Node Translational Spring
152 // 137 Node To Node Rotational Spring
153 // 138 Node To Ground Translational Spring
154 // 139 Node To Ground Rotational Spring
155 // 141 Node To Node Damper
156 // 142 Node To Gound Damper
157 // 151 Node To Node Gap
158 // 152 Node To Ground Gap
160 // 171 Axisymmetric Linear Shell
161 // 172 Axisymmetric Parabolic Shell
163 // 191 Plastic Cold Runner
164 // 192 Plastic Hot Runner
165 // 193 Plastic Water Line
166 // 194 Plastic Fountain
167 // 195 Plastic Baffle
168 // 196 Plastic Rod Heater
169 // 201 Linear node-to-node interface
170 // 202 Linear edge-to-edge interface
171 // 203 Parabolic edge-to-edge interface
172 // 204 Linear face-to-face interface
173 // 208 Parabolic face-to-face interface
174 // 212 Linear axisymmetric interface
175 // 213 Parabolic axisymmetric interface
176 // 221 Linear rigid surface
177 // 222 Parabolic rigin surface
178 // 231 Axisymmetric linear rigid surface
179 // 232 Axisymmetric parabolic rigid surface
183 static string _label_dataset = "2412";
185 UNV2412::TRecord::TRecord():
187 fe_descriptor_id(-1),
188 phys_prop_tab_num(2),
192 beam_fore_end(1), // default values
193 beam_aft_end(1) // default values
196 void UNV2412::Read(std::ifstream& in_stream, TDataSet& theDataSet)
198 if(!in_stream.good())
199 EXCEPTION(runtime_error,"ERROR: Input file not good.");
202 * adjust the \p istream to our
205 if(!beginning_of_dataset(in_stream,_label_dataset))
206 EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
209 while( !in_stream.eof())
211 in_stream >> aRec.label ;
212 if (aRec.label == -1)
213 // end of dataset is reached
217 in_stream>>aRec.fe_descriptor_id;
218 in_stream>>aRec.phys_prop_tab_num;
219 in_stream>>aRec.mat_prop_tab_num;
220 in_stream>>aRec.color;
223 if(IsBeam(aRec.fe_descriptor_id)){
224 in_stream>>aRec.beam_orientation;
225 in_stream>>aRec.beam_fore_end;
226 in_stream>>aRec.beam_aft_end;
229 aRec.node_labels.resize(n_nodes);
230 for(int j=0; j < n_nodes; j++)
232 in_stream>>aRec.node_labels[j];
234 theDataSet.push_back(aRec);
240 void UNV2412::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
242 if(!out_stream.good())
243 EXCEPTION(runtime_error,"ERROR: Output file not good.");
246 * Write beginning of dataset
249 out_stream<<" "<<_label_dataset<<"\n";
251 TDataSet::const_iterator anIter = theDataSet.begin();
252 for(; anIter != theDataSet.end(); anIter++)
254 const TRecord& aRec = *anIter;
255 out_stream<<std::setw(10)<<aRec.label; /* element ID */
256 out_stream<<std::setw(10)<<aRec.fe_descriptor_id; /* type of element */
257 out_stream<<std::setw(10)<<aRec.phys_prop_tab_num;
258 out_stream<<std::setw(10)<<aRec.mat_prop_tab_num;
259 out_stream<<std::setw(10)<<aRec.color;
260 out_stream<<std::setw(10)<<aRec.node_labels.size()<<std::endl; /* No. of nodes per element */
262 if(IsBeam(aRec.fe_descriptor_id))
264 out_stream<<std::setw(10)<<aRec.beam_orientation;
265 out_stream<<std::setw(10)<<aRec.beam_fore_end;
266 out_stream<<std::setw(10)<<aRec.beam_aft_end<<std::endl;
269 int n_nodes = aRec.node_labels.size();
270 int iEnd = (n_nodes-1)/8 + 1;
271 for(int i = 0, k = 0; i < iEnd; i++){
272 int jEnd = n_nodes - 8*(i+1);
277 for(int j = 0; j < jEnd ; k++, j++){
278 out_stream<<std::setw(10)<<aRec.node_labels[k];
280 out_stream<<std::endl;
285 * Write end of dataset
291 bool UNV2412::IsBeam(int theFeDescriptorId){
292 switch (theFeDescriptorId){
293 case 11: // edge with 2 nodes
295 case 22: // edge with 3 nodes
296 case 23: // curved beam
305 bool UNV2412::IsFace(int theFeDescriptorId){
306 return ( 41 <= theFeDescriptorId && theFeDescriptorId <= 96 );
307 // switch (theFeDescriptorId){
313 // case 41: // Plane Stress Linear Triangle - TRI3
314 // case 51: // Plane Strain Linear Triangle
315 // case 91: // Thin Shell Linear Triangle - TRI3
317 // case 42: // Plane Stress Quadratic Triangle - TRI6
318 // case 52: // Plane Strain Parabolic Triangle
319 // case 92: // Thin Shell Quadratic Triangle - TRI6
321 // case 43: // Plane Stress Cubic Triangle
323 // case 44: // Plane Stress Linear Quadrilateral - QUAD4
324 // case 94: // Thin Shell Linear Quadrilateral - QUAD4
326 // case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
327 // case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
329 // case 46: // Plane Stress Cubic Quadrilateral
337 bool UNV2412::IsVolume(int theFeDescriptorId){
338 //if(!IsBeam(theFeDescriptorId) && !IsFace(theFeDescriptorId))
340 switch (theFeDescriptorId){
342 case 111: // Solid Linear Tetrahedron - TET4
343 case 118: // Solid Quadratic Tetrahedron - TET10
345 case 112: // Solid Linear Prism - PRISM6
346 case 113: // Solid Quadratic Prism - PRISM15
348 case 115: // Solid Linear Brick - HEX8
349 case 116: // Solid Quadratic Brick - HEX20
351 case 117: // Solid Cubic Brick
353 case 114: // pyramid of 13 nodes (quadratic)