KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
gid_gauss_point_container.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Riccardo Rossi
11 // Janosch Stascheit
12 // Pooyan Dadvand
13 //
14 
15 #if !defined(KRATOS_GID_GAUSS_POINT_CONTAINER_H_INCLUDED)
16 #define KRATOS_GID_GAUSS_POINT_CONTAINER_H_INCLUDED
17 
18 // System includes
19 #include <string>
20 #include <iostream>
21 #include <fstream>
22 #include <sstream>
23 #include <cstddef>
24 
25 // External includes
26 #include "gidpost/source/gidpost.h"
27 
28 // Project includes
29 #include "includes/define.h"
31 
32 #define tet10_a 0.108103018168070
33 #define tet10_b 0.445948490915965
34 #define tet10_c 0.816847572980459
35 
36 namespace Kratos
37 {
46 
52 {
53 public:
55  GidGaussPointsContainer( const char * gp_title, KratosGeometryFamily geometryFamily,
56  GiD_ElementType gid_element_type,
57  int number_of_integration_points,
58  std::vector<int> index_container )
59  :
60  mGPTitle(gp_title),mKratosElementFamily(geometryFamily),
61  mGidElementFamily(gid_element_type), mSize(number_of_integration_points),
62  mIndexContainer(index_container) {}
63 
66 
67  virtual bool AddElement( const ModelPart::ElementConstantIterator pElemIt )
68  {
70  if( pElemIt->GetGeometry().GetGeometryFamily() == mKratosElementFamily
71  && pElemIt->GetGeometry().IntegrationPoints(
72  pElemIt->GetIntegrationMethod() ).size() == mSize )
73  {
74  mMeshElements.push_back( *(pElemIt.base() ) );
75  return true;
76  }
77  else return false;
78  KRATOS_CATCH("")
79  }
80 
81  virtual bool AddCondition( const ModelPart::ConditionConstantIterator pCondIt )
82  {
84  if( pCondIt->GetGeometry().GetGeometryFamily() == mKratosElementFamily &&
85  pCondIt->GetGeometry().IntegrationPoints(pCondIt->GetIntegrationMethod()).size() == mSize )
86  {
87  mMeshConditions.push_back( *(pCondIt.base() ) );
88  return true;
89  }
90  else return false;
91  KRATOS_CATCH("")
92  }
93 
94  virtual void PrintFlagsResults(
95  GiD_FILE ResultFile,
96  const Kratos::Flags& rFlag,
97  const std::string& rFlagName,
98  const ModelPart& rModelPart,
99  const double SolutionTag
100  )
101  {
102  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 ) {
103  //WriteGaussPoints(ResultFile);
104  GiD_fBeginResult(ResultFile, (char *)(rFlagName).c_str(), (char *)("Kratos"), SolutionTag, GiD_Scalar, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
105  if( mMeshElements.size() != 0 ) {
106  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); it++ ) {
107  const double double_flag = static_cast<double>(it->Is(rFlag));
108  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
109  GiD_fWriteScalar( ResultFile, it->Id(), double_flag);
110  }
111  }
112  }
113  if( mMeshConditions.size() != 0 ) {
114  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
115  const double double_flag = static_cast<double>(it->Is(rFlag));
116  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
117  GiD_fWriteScalar( ResultFile, it->Id(), double_flag );
118  }
119  }
120  }
121  GiD_fEndResult(ResultFile);
122  }
123  }
124 
125  virtual void PrintResults( GiD_FILE ResultFile, const Variable<bool>& rVariable, const ModelPart& rModelPart,
126  const double SolutionTag, const unsigned int ValueIndex )
127  {
128  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 ) {
129  //WriteGaussPoints(ResultFile);
130  GiD_fBeginResult(ResultFile, (char *)(rVariable.Name()).c_str(), (char *)("Kratos"), SolutionTag,
131  GiD_Scalar, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
132 
133  std::vector<bool> ValuesOnIntPoint(mSize);
134  if( mMeshElements.size() != 0 ) {
135  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); it++ ) {
136  if(it->IsActive()) {
137  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
138  rModelPart.GetProcessInfo() );
139  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
140  int index = mIndexContainer[i];
141  GiD_fWriteScalar( ResultFile, it->Id(), static_cast<double>(ValuesOnIntPoint[index]) );
142  }
143  }
144  }
145  }
146  if( mMeshConditions.size() != 0 ) {
147  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
148  if(it->IsActive())
149  {
150  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
151  rModelPart.GetProcessInfo() );
152  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
153  int index = mIndexContainer[i];
154  GiD_fWriteScalar( ResultFile, it->Id(), static_cast<double>(ValuesOnIntPoint[index]) );
155  }
156  }
157  }
158  }
159  GiD_fEndResult(ResultFile);
160  }
161  }
162 
163  virtual void PrintResults( GiD_FILE ResultFile, const Variable<int>& rVariable, const ModelPart& rModelPart,
164  const double SolutionTag, const unsigned int ValueIndex )
165  {
166  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 ) {
167  //WriteGaussPoints(ResultFile);
168  GiD_fBeginResult(ResultFile, (char *)(rVariable.Name()).c_str(), (char *)("Kratos"), SolutionTag,
169  GiD_Scalar, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
170  std::vector<int> ValuesOnIntPoint(mSize);
171  if( mMeshElements.size() != 0 ) {
172  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); it++ ) {
173  if(it->IsActive()) {
174  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
175  rModelPart.GetProcessInfo() );
176  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
177  int index = mIndexContainer[i];
178  GiD_fWriteScalar( ResultFile, it->Id(), static_cast<double>(ValuesOnIntPoint[index]) );
179  }
180  }
181  }
182  }
183  if( mMeshConditions.size() != 0 ) {
184  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
185  if(it->IsActive()) {
186  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
187  rModelPart.GetProcessInfo() );
188  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
189  int index = mIndexContainer[i];
190  GiD_fWriteScalar( ResultFile, it->Id(), static_cast<double>(ValuesOnIntPoint[index]) );
191  }
192  }
193  }
194  }
195  GiD_fEndResult(ResultFile);
196  }
197  }
198 
199  virtual void PrintResults( GiD_FILE ResultFile, const Variable<double>& rVariable, const ModelPart& rModelPart,
200  const double SolutionTag, const unsigned int ValueIndex = 0)
201  {
202  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 )
203  {
204  //WriteGaussPoints(ResultFile);
205  GiD_fBeginResult(ResultFile, (char *)(rVariable.Name()).c_str(), (char *)("Kratos"), SolutionTag,
206  GiD_Scalar, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
207  std::vector<double> ValuesOnIntPoint(mSize);
208  if( mMeshElements.size() != 0 ) {
209  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); it++ ) {
210  if(it->IsActive()) {
211  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
212  rModelPart.GetProcessInfo() );
213  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
214  int index = mIndexContainer[i];
215  GiD_fWriteScalar( ResultFile, it->Id(), ValuesOnIntPoint[index] );
216  }
217  }
218  }
219  }
220  if( mMeshConditions.size() != 0 ) {
221  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
222  if(it->IsActive()) {
223  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
224  rModelPart.GetProcessInfo() );
225  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
226  int index = mIndexContainer[i];
227  GiD_fWriteScalar( ResultFile, it->Id(), ValuesOnIntPoint[index] );
228  }
229  }
230  }
231  }
232  GiD_fEndResult(ResultFile);
233  }
234  }
235 
236  virtual void PrintResults( GiD_FILE ResultFile, const Variable<array_1d<double,3> >& rVariable, const ModelPart& rModelPart,
237  const double SolutionTag, const unsigned int ValueIndex = 0)
238  {
239  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 ) {
240  //WriteGaussPoints(ResultFile);
241  GiD_fBeginResult( ResultFile, (char *)(rVariable.Name()).c_str(), (char *)("Kratos"), SolutionTag,
242  GiD_Vector, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
243  std::vector<array_1d<double,3> > ValuesOnIntPoint(mSize,ZeroVector(3));
244  if( mMeshElements.size() != 0 ) {
245  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); it++ ) {
246  if(it->IsActive()) {
247  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
248  rModelPart.GetProcessInfo() );
249  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
250  int index = mIndexContainer[i];
251  if( ValuesOnIntPoint[0].size() == 3 )
252  GiD_fWriteVector( ResultFile, it->Id(), ValuesOnIntPoint[index][0],
253  ValuesOnIntPoint[index][1], ValuesOnIntPoint[index][2] );
254  }
255  }
256  }
257  }
258  if( mMeshConditions.size() != 0 ) {
259  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
260  if(it->IsActive()) {
261  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
262  rModelPart.GetProcessInfo() );
263  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
264  int index = mIndexContainer[i];
265  GiD_fWriteVector( ResultFile, it->Id(), ValuesOnIntPoint[index][0],
266  ValuesOnIntPoint[index][1], ValuesOnIntPoint[index][2] );
267  }
268  }
269  }
270  }
271  GiD_fEndResult(ResultFile);
272  }
273  }
274 
275  virtual void PrintResults( GiD_FILE ResultFile, const Variable<array_1d<double,6> >& rVariable, const ModelPart& rModelPart,
276  const double SolutionTag, const unsigned int ValueIndex = 0)
277  {
278  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 )
279  {
280  //WriteGaussPoints(ResultFile);
281  GiD_fBeginResult( ResultFile, (char *)(rVariable.Name()).c_str(), ( char*)("Kratos"),
282  SolutionTag, GiD_Matrix, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
283  std::vector<array_1d<double, 6> > ValuesOnIntPoint(mSize);
284  if( mMeshElements.size() != 0 ) {
285  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); ++it ) {
286  if(it->IsActive())
287  {
288  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
289  rModelPart.GetProcessInfo() );
290  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
291  int index = mIndexContainer[i];
292  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index][0],
293  ValuesOnIntPoint[index][1], ValuesOnIntPoint[index][2],
294  ValuesOnIntPoint[index][3], ValuesOnIntPoint[index][4],
295  ValuesOnIntPoint[index][5] );
296  }
297  }
298  }
299  }
300  if( mMeshConditions.size() != 0 ) {
301  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
302  if(it->IsActive()) {
303  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
304  rModelPart.GetProcessInfo() );
305  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
306  int index = mIndexContainer[i];
307  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index][0],
308  ValuesOnIntPoint[index][1], ValuesOnIntPoint[index][2],
309  ValuesOnIntPoint[index][3], ValuesOnIntPoint[index][4],
310  ValuesOnIntPoint[index][5] );
311  }
312  }
313  }
314  }
315  GiD_fEndResult(ResultFile);
316  }
317  }
318 
319 
320  virtual void PrintResults( GiD_FILE ResultFile, const Variable<Vector>& rVariable, const ModelPart& rModelPart,
321  const double SolutionTag, const unsigned int ValueIndex = 0)
322  {
323  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 )
324  {
325  //WriteGaussPoints(ResultFile);
326  GiD_fBeginResult( ResultFile, (char *)(rVariable.Name()).c_str(), (char *)("Kratos"), SolutionTag,
327  GiD_Matrix, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
328 
329  std::vector<Vector> ValuesOnIntPoint(mSize);
330  if( mMeshElements.size() != 0 ) {
331  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); ++it ) {
332  if(it->IsActive()) {
333  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
334  rModelPart.GetProcessInfo() );
335  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
336  int index = mIndexContainer[i];
337  const auto& values = ValuesOnIntPoint[index];
338  if (values.size() ==3 )
339  GiD_fWrite2DMatrix(ResultFile, it->Id(), values[0], values[1], values[2]);
340  else if (values.size() == 6 )
341  GiD_fWrite3DMatrix( ResultFile, it->Id(), values[0], values[1], values[2],
342  values[3], values[4], values[5] );
343  }
344  }
345  }
346  }
347  if( mMeshConditions.size() != 0 ) {
348  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
349  if(it->IsActive()) {
350  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
351  rModelPart.GetProcessInfo() );
352  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
353  int index = mIndexContainer[i];
354  const auto& values = ValuesOnIntPoint[index];
355  if (values.size() ==3 )
356  GiD_fWrite2DMatrix(ResultFile, it->Id(), values[0], values[1], values[2]);
357  else if (values.size() == 6 )
358  GiD_fWrite3DMatrix( ResultFile, it->Id(), values[0], values[1], values[2],
359  values[3], values[4], values[5] );
360  }
361  }
362  }
363  }
364  GiD_fEndResult(ResultFile);
365  }
366  }
367 
368  virtual void PrintResults( GiD_FILE ResultFile, const Variable<Matrix>& rVariable, const ModelPart& rModelPart,
369  const double SolutionTag, const unsigned int ValueIndex = 0)
370  {
371  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 ) {
372  //WriteGaussPoints(ResultFile);
373  GiD_fBeginResult(ResultFile, (char *)(rVariable.Name()).c_str(), (char *)("Kratos"),
374  SolutionTag, GiD_Matrix, GiD_OnGaussPoints, mGPTitle, NULL, 0, NULL );
375  std::vector<Matrix> ValuesOnIntPoint(mSize);
376  if( mMeshElements.size() != 0 ) {
377  for( auto it = mMeshElements.begin(); it != mMeshElements.end(); ++it ) {
378  if(it->IsActive()) {
379  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
380  rModelPart.GetProcessInfo() );
381  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
382  int index = mIndexContainer[i];
383  if(ValuesOnIntPoint[index].size1() ==3
384  && ValuesOnIntPoint[index].size2() ==3) {
385  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
386  ValuesOnIntPoint[index](1,1), ValuesOnIntPoint[index](2,2),
387  ValuesOnIntPoint[index](0,1), ValuesOnIntPoint[index](1,2),
388  ValuesOnIntPoint[index](0,2) );
389  }
390  else if(ValuesOnIntPoint[index].size1() ==2
391  && ValuesOnIntPoint[index].size2() ==2) {
392  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
393  ValuesOnIntPoint[index](1,1), 0.0,
394  ValuesOnIntPoint[index](0,1), 0.0, 0.0);
395  }
396  else if(ValuesOnIntPoint[index].size1() ==1
397  && ValuesOnIntPoint[index].size2() ==3) {
398  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
399  ValuesOnIntPoint[index](0,1), 0.0,
400  ValuesOnIntPoint[index](0,2), 0.0, 0.0);
401  }
402  else if(ValuesOnIntPoint[index].size1() ==1
403  && ValuesOnIntPoint[index].size2() ==4) {
404  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
405  ValuesOnIntPoint[index](0,1), ValuesOnIntPoint[index](0,2),
406  ValuesOnIntPoint[index](0,3), 0.0, 0.0);
407  }
408  else if(ValuesOnIntPoint[index].size1() ==1
409  && ValuesOnIntPoint[index].size2() ==6) {
410  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
411  ValuesOnIntPoint[index](0,1), ValuesOnIntPoint[index](0,2),
412  ValuesOnIntPoint[index](0,3), ValuesOnIntPoint[index](0,4),
413  ValuesOnIntPoint[index](0,5) );
414  }
415  }
416  }
417  }
418 
419  // Resize first matrix to (0,0) for test below
420  ValuesOnIntPoint[0].resize(0, 0, false);
421 
422  }
423  if( mMeshConditions.size() != 0 ) {
424  for( auto it = mMeshConditions.begin(); it != mMeshConditions.end(); it++ ) {
425  if(it->IsActive()) {
426  it->CalculateOnIntegrationPoints( rVariable, ValuesOnIntPoint,
427  rModelPart.GetProcessInfo() );
428 
429  if (ValuesOnIntPoint[0].size1() == 0 && ValuesOnIntPoint[0].size2() == 0) {
430  // If we aren't getting any results, break
431  break;
432  }
433 
434  for(unsigned int i=0; i<mIndexContainer.size(); i++) {
435  int index = mIndexContainer[i];
436  if(ValuesOnIntPoint[index].size1() ==3
437  && ValuesOnIntPoint[index].size2() ==3) {
438  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
439  ValuesOnIntPoint[index](1,1), ValuesOnIntPoint[index](2,2),
440  ValuesOnIntPoint[index](0,1), ValuesOnIntPoint[index](1,2),
441  ValuesOnIntPoint[index](0,2) );
442  }
443  else if(ValuesOnIntPoint[index].size1() ==1
444  && ValuesOnIntPoint[index].size2() ==6) {
445  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
446  ValuesOnIntPoint[index](0,1), ValuesOnIntPoint[index](0,2),
447  ValuesOnIntPoint[index](0,3), ValuesOnIntPoint[index](0,4),
448  ValuesOnIntPoint[index](0,5) );
449  }
450  else if(ValuesOnIntPoint[index].size1() ==1
451  && ValuesOnIntPoint[index].size2() ==3) {
452  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
453  ValuesOnIntPoint[index](0,1), 0.0,
454  ValuesOnIntPoint[index](0,2), 0.0, 0.0);
455  }
456  else if(ValuesOnIntPoint[index].size1() ==1
457  && ValuesOnIntPoint[index].size2() ==4) {
458  GiD_fWrite3DMatrix( ResultFile, it->Id(), ValuesOnIntPoint[index](0,0),
459  ValuesOnIntPoint[index](0,1), ValuesOnIntPoint[index](0,2),
460  ValuesOnIntPoint[index](0,3), 0.0, 0.0);
461  }
462  }
463  }
464  }
465  }
466  GiD_fEndResult(ResultFile);
467  }
468  }
469 
470  void Reset()
471  {
472  mMeshElements.clear();
473  mMeshConditions.clear();
474  }
475 
476 public:
477  void WriteGaussPoints(GiD_FILE MeshFile)
478  {
479  if( mMeshElements.size() != 0 || mMeshConditions.size() != 0 )
480  {
481  //setting up gauss points
482  if( mGidElementFamily == GiD_Tetrahedra && mSize == 4 )
483  {
484  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Tetrahedra, NULL, 4, 0, 0 );
485  GiD_fWriteGaussPoint3D( MeshFile, 0.58541020,0.13819660,0.13819660 );
486  GiD_fWriteGaussPoint3D( MeshFile, 0.13819660,0.58541020,0.13819660 );
487  GiD_fWriteGaussPoint3D( MeshFile, 0.13819660,0.13819660,0.58541020 );
488  GiD_fWriteGaussPoint3D( MeshFile, 0.13819660,0.13819660,0.13819660 );
489  GiD_fEndGaussPoint(MeshFile);
490  }
491  else if( mGidElementFamily == GiD_Quadrilateral && mSize == 4 )
492  {
493  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Quadrilateral, NULL, 4, 0, 0 );
494  GiD_fWriteGaussPoint2D( MeshFile, - 1.00/std::sqrt(3.0), - 1.00/std::sqrt(3.0) );
495  GiD_fWriteGaussPoint2D( MeshFile, 1.00/std::sqrt(3.0), - 1.00/std::sqrt(3.0) );
496  GiD_fWriteGaussPoint2D( MeshFile, 1.00/std::sqrt(3.0), 1.00/std::sqrt(3.0) );
497  GiD_fWriteGaussPoint2D( MeshFile, - 1.00/std::sqrt(3.0), 1.00/std::sqrt(3.0) );
498  GiD_fEndGaussPoint(MeshFile);
499  }
500  else if( mGidElementFamily == GiD_Quadrilateral && mSize == 9 )
501  {
502  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Quadrilateral, NULL, 9, 0, 0 );
503  GiD_fWriteGaussPoint2D( MeshFile, -std::sqrt(3.00/5.00) , -std::sqrt(3.00/5.00));
504  GiD_fWriteGaussPoint2D( MeshFile, 0.00 , -std::sqrt(3.00/5.00) );
505  GiD_fWriteGaussPoint2D( MeshFile, std::sqrt(3.00/5.00) , -std::sqrt(3.00/5.00) );
506  GiD_fWriteGaussPoint2D( MeshFile, -std::sqrt(3.00/5.00), 0.00 );
507  GiD_fWriteGaussPoint2D( MeshFile, 0.00 , 0.00 );
508  GiD_fWriteGaussPoint2D( MeshFile, std::sqrt(3.00/5.00), 0.00);
509  GiD_fWriteGaussPoint2D( MeshFile, -std::sqrt(3.00/5.00), std::sqrt(3.00/5.00) );
510  GiD_fWriteGaussPoint2D( MeshFile, 0.00, std::sqrt(3.00/5.00) );
511  GiD_fWriteGaussPoint2D( MeshFile, std::sqrt(3.00/5.00), std::sqrt(3.00/5.00) );
512  GiD_fEndGaussPoint(MeshFile);
513  }
514  else if( mGidElementFamily == GiD_Tetrahedra && mSize == 5 )
515  {
516  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Tetrahedra, NULL, 4, 0, 0 );
517  GiD_fWriteGaussPoint3D( MeshFile, 1.0/6.0, 1.0/6.0, 1.0/6.0 );
518  GiD_fWriteGaussPoint3D( MeshFile, 1.0/2.0, 1.0/6.0, 1.0/6.0 );
519  GiD_fWriteGaussPoint3D( MeshFile, 1.0/6.0, 1.0/2.0, 1.0/6.0 );
520  GiD_fWriteGaussPoint3D( MeshFile, 1.0/6.0, 1.0/6.0, 1.0/2.0 );
521  GiD_fEndGaussPoint(MeshFile);
522  }
523  else if( mGidElementFamily == GiD_Tetrahedra && mSize == 10 )
524  {
525  GiD_fBeginGaussPoint(MeshFile, "tet10_element_gp", GiD_Tetrahedra, NULL, 10, 0, 0);
526  GiD_fWriteGaussPoint3D(MeshFile, tet10_a, tet10_a, tet10_a );
527  GiD_fWriteGaussPoint3D(MeshFile, tet10_c, tet10_a, tet10_a );
528  GiD_fWriteGaussPoint3D(MeshFile, tet10_a, tet10_c, tet10_a );
529  GiD_fWriteGaussPoint3D(MeshFile, tet10_a, tet10_a, tet10_c );
530  GiD_fWriteGaussPoint3D(MeshFile, tet10_b, tet10_a, tet10_a );
531  GiD_fWriteGaussPoint3D(MeshFile, tet10_b, tet10_b, tet10_a );
532  GiD_fWriteGaussPoint3D(MeshFile, tet10_a, tet10_b, tet10_a );
533  GiD_fWriteGaussPoint3D(MeshFile, tet10_a, tet10_a, tet10_b );
534  GiD_fWriteGaussPoint3D(MeshFile, tet10_b, tet10_a, tet10_b );
535  GiD_fWriteGaussPoint3D(MeshFile, tet10_a, tet10_b, tet10_b );
536  GiD_fEndGaussPoint(MeshFile);
537  }
538  else if( mGidElementFamily == GiD_Tetrahedra && mSize == 11 )
539  {
540  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Tetrahedra, NULL, 4, 0, 0 );
541  GiD_fWriteGaussPoint3D( MeshFile, 1.0/14.0, 1.0/14.0, 1.0/14.0 );
542  GiD_fWriteGaussPoint3D( MeshFile, 11.0/14.0, 1.0/14.0, 1.0/14.0 );
543  GiD_fWriteGaussPoint3D( MeshFile, 1.0/14.0, 11.0/14.0, 1.0/14.0 );
544  GiD_fWriteGaussPoint3D( MeshFile, 1.0/14.0, 1.0/14.0, 11.0/14.0 );
545  GiD_fEndGaussPoint(MeshFile);
546  }
547  else if ( mGidElementFamily == GiD_Triangle && mSize == 3 )
548  {
549  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Triangle, NULL, 3, 0, 0 );
550  GiD_fWriteGaussPoint2D( MeshFile, 1.0/6.0, 1.0/6.0 );
551  GiD_fWriteGaussPoint2D( MeshFile, 2.0/3.0, 1.0/6.0 );
552  GiD_fWriteGaussPoint2D( MeshFile, 1.0/6.0, 2.0/3.0 );
553  GiD_fEndGaussPoint(MeshFile);
554  }
555  else if ( mGidElementFamily == GiD_Prism && mSize > 1)
556  {
557  GiD_fBeginGaussPoint( MeshFile, mGPTitle, GiD_Prism, NULL, 6, 0, 0 );
558 
559  GiD_fWriteGaussPoint3D(MeshFile, 1.00 / 6.00, 1.00 / 6.00, 0.5 * (1.0 - std::sqrt(1.00 / 3.00)));
560  GiD_fWriteGaussPoint3D(MeshFile, 2.00 / 3.00, 1.00 / 6.00, 0.5 * (1.0 - std::sqrt(1.00 / 3.00)));
561  GiD_fWriteGaussPoint3D(MeshFile, 1.00 / 6.00, 2.00 / 3.00, 0.5 * (1.0 - std::sqrt(1.00 / 3.00)));
562 
563  GiD_fWriteGaussPoint3D(MeshFile, 1.00 / 6.00, 1.00 / 6.00, 0.5 * (1.0 + std::sqrt(1.00 / 3.00)));
564  GiD_fWriteGaussPoint3D(MeshFile, 2.00 / 3.00, 1.00 / 6.00, 0.5 * (1.0 + std::sqrt(1.00 / 3.00)));
565  GiD_fWriteGaussPoint3D(MeshFile, 1.00 / 6.00, 2.00 / 3.00, 0.5 * (1.0 + std::sqrt(1.00 / 3.00)));
566 
567  GiD_fEndGaussPoint(MeshFile);
568  }
569  else if ( mGidElementFamily == GiD_Point || mGidElementFamily == GiD_Sphere || mGidElementFamily == GiD_Circle )
570  {
571  //Gid does not accept gauss points on Points, Circles or Spheres! (october 18th 2014)
572  }
573  else
574  {
575  GiD_fBeginGaussPoint(MeshFile, mGPTitle, mGidElementFamily, NULL, mSize, 0, 1);
576  GiD_fEndGaussPoint(MeshFile);
577  /* NOTE: for linear elements, GiD gauss point coordinates are equispaced, visualization coordinates
578  * are wrong. Is there a GiD_fWriteGaussPoint2D equivalent for lines? Not according to documentation!
579  * gidpost documentation does not list one,
580  * GiD 12 explicitly states in the post format documentation that line coordinates cannot be given.
581  */
582  }
583  }
584  }
585 
586 
587 protected:
588 
589 
591  const char * mGPTitle;
593  GiD_ElementType mGidElementFamily;
594  unsigned int mSize;
595  std::vector<int> mIndexContainer;
598 };//class GidGaussPointsContainer
599 }// namespace Kratos.
600 
601 #endif // KRATOS_GID_GAUSS_POINT_CONTAINER_H_INCLUDED defined
602 
Definition: flags.h:58
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
Definition: gid_gauss_point_container.h:52
KratosGeometryFamily mKratosElementFamily
Definition: gid_gauss_point_container.h:592
const char * mGPTitle
member variables
Definition: gid_gauss_point_container.h:591
void Reset()
Definition: gid_gauss_point_container.h:470
std::vector< int > mIndexContainer
Definition: gid_gauss_point_container.h:595
virtual void PrintResults(GiD_FILE ResultFile, const Variable< Vector > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex=0)
Definition: gid_gauss_point_container.h:320
virtual ~GidGaussPointsContainer()
Destructor.
Definition: gid_gauss_point_container.h:65
virtual void PrintResults(GiD_FILE ResultFile, const Variable< int > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex)
Definition: gid_gauss_point_container.h:163
virtual void PrintResults(GiD_FILE ResultFile, const Variable< array_1d< double, 6 > > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex=0)
Definition: gid_gauss_point_container.h:275
virtual bool AddCondition(const ModelPart::ConditionConstantIterator pCondIt)
Definition: gid_gauss_point_container.h:81
virtual void PrintResults(GiD_FILE ResultFile, const Variable< Matrix > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex=0)
Definition: gid_gauss_point_container.h:368
virtual void PrintResults(GiD_FILE ResultFile, const Variable< bool > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex)
Definition: gid_gauss_point_container.h:125
GidGaussPointsContainer(const char *gp_title, KratosGeometryFamily geometryFamily, GiD_ElementType gid_element_type, int number_of_integration_points, std::vector< int > index_container)
Constructor.
Definition: gid_gauss_point_container.h:55
unsigned int mSize
Definition: gid_gauss_point_container.h:594
ModelPart::ConditionsContainerType mMeshConditions
Definition: gid_gauss_point_container.h:597
virtual void PrintFlagsResults(GiD_FILE ResultFile, const Kratos::Flags &rFlag, const std::string &rFlagName, const ModelPart &rModelPart, const double SolutionTag)
Definition: gid_gauss_point_container.h:94
ModelPart::ElementsContainerType mMeshElements
Definition: gid_gauss_point_container.h:596
void WriteGaussPoints(GiD_FILE MeshFile)
Definition: gid_gauss_point_container.h:477
virtual void PrintResults(GiD_FILE ResultFile, const Variable< double > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex=0)
Definition: gid_gauss_point_container.h:199
GiD_ElementType mGidElementFamily
Definition: gid_gauss_point_container.h:593
virtual void PrintResults(GiD_FILE ResultFile, const Variable< array_1d< double, 3 > > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const unsigned int ValueIndex=0)
Definition: gid_gauss_point_container.h:236
virtual bool AddElement(const ModelPart::ElementConstantIterator pElemIt)
Definition: gid_gauss_point_container.h:67
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
MeshType::ConditionConstantIterator ConditionConstantIterator
Definition: model_part.h:195
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
MeshType::ElementConstantIterator ElementConstantIterator
Definition: model_part.h:180
const std::string & Name() const
Definition: variable_data.h:201
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define tet10_b
Definition: gid_gauss_point_container.h:33
#define tet10_a
Definition: gid_gauss_point_container.h:32
#define tet10_c
Definition: gid_gauss_point_container.h:34
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
GeometryData::IntegrationMethod IntegrationMethodType
Definition: gid_gauss_point_container.h:44
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: gid_gauss_point_container.h:43
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
ModelPart::ElementsContainerType ElementsArrayType
Definition: gid_gauss_point_container.h:41
GeometryData::KratosGeometryFamily KratosGeometryFamily
Definition: gid_gauss_point_container.h:45
list values
Definition: bombardelli_test.py:42
integer i
Definition: TensorModule.f:17