15 #if !defined(KRATOS_GID_OUTPUT_H_INCLUDED)
16 #define KRATOS_GID_OUTPUT_H_INCLUDED
28 #include "gidpost/source/gidpost.h"
91 void SetData(
int data);
109 template<
class TGaussPo
intContainer = G
idGaussPo
intsContainer,
class TMeshContainer = G
idMeshContainer>
146 const std::string& rDatafilename,
147 const GiD_PostMode Mode,
151 const bool InitializeGaussPointContainers=
true
152 ) : mResultFileName(rDatafilename),
153 mMeshFileName(rDatafilename),
154 mWriteDeformed(WriteDeformedFlag),
156 mUseMultiFile(UseMultipleFilesFlag),
159 mResultFileOpen =
false;
160 mMeshFileOpen =
false;
162 InitializeResultFile(mResultFileName);
163 SetUpMeshContainers();
164 if (InitializeGaussPointContainers) {
165 SetUpGaussPointContainers();
170 if (r_gid_io_base.
GetData() == 0){
179 if ( mResultFileOpen ) {
180 GiD_fClosePostResultFile( mResultFile );
181 mResultFileOpen =
false;
188 if (r_gid_io_base.
GetData() == 0) {
223 mGidMeshContainers.push_back( TMeshContainer(
225 GiD_Hexahedra,
"Kratos_Hexahedra3D20_Mesh" ) );
226 mGidMeshContainers.push_back( TMeshContainer(
228 GiD_Hexahedra,
"Kratos_Hexahedra3D27_Mesh" ) );
229 mGidMeshContainers.push_back( TMeshContainer(
231 GiD_Hexahedra,
"Kratos_Hexahedra3D8_Mesh" ) );
232 mGidMeshContainers.push_back( TMeshContainer(
234 GiD_Prism,
"Kratos_Prism3D15_Mesh" ) );
235 mGidMeshContainers.push_back( TMeshContainer(
237 GiD_Prism,
"Kratos_Prism3D6_Mesh" ) );
238 mGidMeshContainers.push_back( TMeshContainer(
240 GiD_Quadrilateral,
"Kratos_Quadrilateral2D4_Mesh" ) );
241 mGidMeshContainers.push_back( TMeshContainer(
243 GiD_Quadrilateral,
"Kratos_Quadrilateral2D8_Mesh" ) );
244 mGidMeshContainers.push_back( TMeshContainer(
246 GiD_Quadrilateral,
"Kratos_Quadrilateral2D9_Mesh" ) );
247 mGidMeshContainers.push_back( TMeshContainer(
249 GiD_Quadrilateral,
"Kratos_Quadrilateral3D4_Mesh" ) );
250 mGidMeshContainers.push_back( TMeshContainer(
252 GiD_Quadrilateral,
"Kratos_Quadrilateral3D8_Mesh" ) );
253 mGidMeshContainers.push_back( TMeshContainer(
255 GiD_Quadrilateral,
"Kratos_Quadrilateral3D9_Mesh" ) );
256 mGidMeshContainers.push_back( TMeshContainer(
258 GiD_Tetrahedra,
"Kratos_Tetrahedra3D10_Mesh" ) );
259 mGidMeshContainers.push_back( TMeshContainer(
261 GiD_Tetrahedra,
"Kratos_Tetrahedra3D4_Mesh" ) );
262 mGidMeshContainers.push_back( TMeshContainer(
264 GiD_Triangle,
"Kratos_Triangle2D3_Mesh" ) );
265 mGidMeshContainers.push_back( TMeshContainer(
267 GiD_Triangle,
"Kratos_Triangle2D6_Mesh" ) );
268 mGidMeshContainers.push_back( TMeshContainer(
270 GiD_Triangle,
"Kratos_Triangle3D3_Mesh" ) );
271 mGidMeshContainers.push_back( TMeshContainer(
273 GiD_Triangle,
"Kratos_Triangle3D6_Mesh" ) );
274 mGidMeshContainers.push_back( TMeshContainer(
276 GiD_Linear,
"Kratos_Line2D2_Mesh" ) );
277 mGidMeshContainers.push_back( TMeshContainer(
279 GiD_Linear,
"Kratos_Line3D2_Mesh" ) );
280 mGidMeshContainers.push_back( TMeshContainer(
282 GiD_Linear,
"Kratos_Line2D3_Mesh" ) );
283 mGidMeshContainers.push_back( TMeshContainer(
285 GiD_Linear,
"Kratos_Line3D3_Mesh" ) );
286 mGidMeshContainers.push_back( TMeshContainer(
288 GiD_Point,
"Kratos_Point2D_Mesh" ) );
289 mGidMeshContainers.push_back( TMeshContainer(
291 GiD_Point,
"Kratos_Point3D_Mesh" ) );
303 std::vector<int> gp_indices(1, 0);
306 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tri1_element_gp",
309 mGidGaussPointContainers.push_back( TGaussPointContainer(
"quad1_element_gp",
312 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tet1_element_gp",
315 mGidGaussPointContainers.push_back( TGaussPointContainer(
"hex1_element_gp",
318 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism1_element_gp",
321 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin1_element_gp",
325 gp_indices.resize(2);
327 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin2_element_gp",
332 gp_indices.resize(3);
335 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tri3_element_gp",
338 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin3_element_gp",
342 gp_indices.resize(4);
346 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin3_element_gp",
349 mGidGaussPointContainers.push_back( TGaussPointContainer(
"quad4_element_gp",
352 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tet4_element_gp",
355 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tri4_element_gp",
362 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tet5_element_gp",
365 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tet11_element_gp",
370 gp_indices.resize(5);
377 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin5_element_gp",
381 gp_indices.resize(10);
387 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tet10_element_gp",
391 gp_indices.resize(6);
399 mGidGaussPointContainers.push_back( TGaussPointContainer(
"tri6_element_gp",
402 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism6_element_gp",
407 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism2_element_gp",
410 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism3_element_gp",
413 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism5_element_gp",
416 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism7_element_gp",
419 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism11_element_gp",
424 gp_indices.resize(7);
427 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin7_element_gp",
430 gp_indices.resize(8);
433 mGidGaussPointContainers.push_back( TGaussPointContainer(
"hex8_element_gp",
437 gp_indices.resize(9);
440 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin9_element_gp",
443 mGidGaussPointContainers.push_back( TGaussPointContainer(
"prism9_element_gp",
446 mGidGaussPointContainers.push_back( TGaussPointContainer(
"quad9_element_gp",
450 gp_indices.resize(11);
453 mGidGaussPointContainers.push_back( TGaussPointContainer(
"lin11_element_gp",
457 gp_indices.resize(27);
486 mGidGaussPointContainers.push_back( TGaussPointContainer(
"hex27_element_gp",
501 mMeshFileName = rDatafilename;
502 mResultFileName = rDatafilename;
512 mResultFileName = rResultFileName;
520 if ( mResultFileOpen )
522 GiD_fClosePostResultFile( mResultFile );
523 mResultFileOpen =
false;
532 GiD_fFlushPostFile( mResultFile );
539 std::string
Info()
const override
571 if ( mMode == GiD_PostAscii && ! mResultFileOpen )
575 file_name << mResultFileName <<
".post.res";
577 file_name << mResultFileName << std::setprecision(12) <<
"_" << name <<
".post.res";
579 mResultFile = GiD_fOpenPostResultFile((
char*)(
file_name.str()).c_str(), mMode);
580 mResultFileOpen =
true;
585 for (
auto element_iterator = rThisMesh.
ElementsBegin(); element_iterator != rThisMesh.
ElementsEnd(); ++element_iterator )
587 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ )
589 if ( it->AddElement( element_iterator ) )
599 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ )
602 if ( it->AddCondition( conditions_iterator ) )
608 for (
auto it = mGidGaussPointContainers.begin();
609 it != mGidGaussPointContainers.end(); it++ )
611 it->WriteGaussPoints(mResultFile);
620 if ( mUseMultiFile ==
MultipleFiles || mMode == GiD_PostAscii )
622 GiD_fClosePostResultFile( mResultFile );
623 mResultFileOpen =
false;
627 mGidGaussPointContainers.begin();
628 it != mGidGaussPointContainers.end(); it++ )
645 const double SolutionTag,
646 const std::size_t SolutionStepNumber
650 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
651 SolutionTag, GiD_Scalar,
652 GiD_OnNodes, NULL, NULL, 0, NULL );
653 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
654 GiD_fWriteScalar( mResultFile, it_node->Id(),
static_cast<double>(it_node->GetSolutionStepValue(rVariable,
655 SolutionStepNumber)) );
656 GiD_fEndResult(mResultFile);
669 const double SolutionTag,
670 const std::size_t SolutionStepNumber
674 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
675 SolutionTag, GiD_Scalar,
676 GiD_OnNodes, NULL, NULL, 0, NULL );
677 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
678 GiD_fWriteScalar( mResultFile, it_node->Id(), it_node->GetSolutionStepValue(rVariable,
679 SolutionStepNumber) );
680 GiD_fEndResult(mResultFile);
691 const double SolutionTag,
692 const std::size_t SolutionStepNumber
696 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
697 SolutionTag, GiD_Scalar,
698 GiD_OnNodes, NULL, NULL, 0, NULL );
699 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
700 GiD_fWriteScalar( mResultFile, it_node->Id(), it_node->GetSolutionStepValue(rVariable,
701 SolutionStepNumber) );
702 GiD_fEndResult(mResultFile);
715 const double SolutionTag,
716 const std::size_t SolutionStepNumber
721 GiD_fBeginResult(mResultFile,(
char*)(rVariable.Name().c_str()),
"Kratos",
722 SolutionTag, GiD_Vector,
723 GiD_OnNodes, NULL, NULL, 0, NULL );
724 for (
auto it_node = rNodes.
begin();
725 it_node != rNodes.
end() ; ++it_node)
728 SolutionStepNumber );
729 GiD_fWriteVector( mResultFile, it_node->Id(),
temp[0],
temp[1],
temp[2] );
731 GiD_fEndResult(mResultFile);
743 const double SolutionTag,
744 const std::size_t SolutionStepNumber
749 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
750 SolutionTag, GiD_Matrix,
751 GiD_OnNodes, NULL, NULL, 0, NULL );
752 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
754 const Vector& temp_vector = it_node->FastGetSolutionStepValue(rVariable,
756 if (temp_vector.size() ==3 )
757 GiD_fWrite2DMatrix(mResultFile, it_node->Id(), temp_vector[0], temp_vector[1], temp_vector[2]);
758 else if (temp_vector.size() == 6 )
759 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_vector[0], temp_vector[1], temp_vector[2],
760 temp_vector[3], temp_vector[4], temp_vector[5] );
762 GiD_fEndResult(mResultFile);
773 const double SolutionTag,
774 const std::size_t SolutionStepNumber
779 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
780 SolutionTag, GiD_Matrix,
781 GiD_OnNodes, NULL, NULL, 0, NULL );
782 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
784 const Matrix& temp_matrix = it_node->GetSolutionStepValue(rVariable,
786 if (temp_matrix.size1() ==3 && temp_matrix.size2() ==3)
788 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(1,1),
789 temp_matrix(2,2), temp_matrix(0,1), temp_matrix(1,2),
792 else if (temp_matrix.size1() ==2 && temp_matrix.size2() ==2)
794 GiD_fWrite2DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(1,1), temp_matrix(0,1));
797 else if (temp_matrix.size1() ==1 && temp_matrix.size2() ==3)
800 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(0,1), 0.00,
801 temp_matrix(0,2), 0.00, 0.00);
803 else if (temp_matrix.size1() ==1 && temp_matrix.size2() ==6)
805 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(0,1), temp_matrix(0,2),
806 temp_matrix(0,3), temp_matrix(0,4), temp_matrix(0,5) );
811 GiD_fEndResult(mResultFile);
819 const double SolutionTag,
820 const std::size_t SolutionStepNumber
825 GiD_fBeginResult( mResultFile, (
char*)(rVariable.Name().c_str()),
"Kratos",
826 SolutionTag, GiD_LocalAxes,
827 GiD_OnNodes, NULL, NULL, 0, NULL );
829 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
832 SolutionStepNumber );
833 GiD_fWriteLocalAxes( mResultFile, it_node->Id(),
temp[0],
temp[1],
temp[2] );
835 GiD_fEndResult(mResultFile);
849 const std::string& rFlagName,
851 const double SolutionTag
855 GiD_fBeginResult( mResultFile, (
char*)(rFlagName.c_str()),
"Kratos",
856 SolutionTag, GiD_Scalar,
857 GiD_OnNodes, NULL, NULL, 0, NULL );
858 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
860 GiD_fWriteScalar( mResultFile, it_node->Id(),
static_cast<double>(it_node->Is(rFlag)));
862 GiD_fEndResult(mResultFile);
873 const double SolutionTag
877 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
878 SolutionTag, GiD_Scalar,
879 GiD_OnNodes, NULL, NULL, 0, NULL );
880 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
881 GiD_fWriteScalar( mResultFile, it_node->Id(),
static_cast<double>(it_node->GetValue(rVariable)) );
882 GiD_fEndResult(mResultFile);
894 const double SolutionTag
898 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
899 SolutionTag, GiD_Scalar,
900 GiD_OnNodes, NULL, NULL, 0, NULL );
901 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
902 GiD_fWriteScalar( mResultFile, it_node->Id(), it_node->GetValue(rVariable) );
903 GiD_fEndResult(mResultFile);
914 const double SolutionTag
918 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
919 SolutionTag, GiD_Scalar,
920 GiD_OnNodes, NULL, NULL, 0, NULL );
921 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
922 GiD_fWriteScalar( mResultFile, it_node->Id(), it_node->GetValue(rVariable) );
923 GiD_fEndResult(mResultFile);
935 const double SolutionTag
940 GiD_fBeginResult(mResultFile,(
char*)(rVariable.Name().c_str()),
"Kratos",
941 SolutionTag, GiD_Vector,
942 GiD_OnNodes, NULL, NULL, 0, NULL );
943 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
946 GiD_fWriteVector( mResultFile, it_node->Id(),
temp[0],
temp[1],
temp[2] );
948 GiD_fEndResult(mResultFile);
960 const double SolutionTag
965 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
966 SolutionTag, GiD_Matrix,
967 GiD_OnNodes, NULL, NULL, 0, NULL );
968 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
970 const Vector& temp_vector = it_node->GetValue(rVariable);
971 if (temp_vector.size() ==3 )
972 GiD_fWrite2DMatrix(mResultFile, it_node->Id(), temp_vector[0], temp_vector[1], temp_vector[2]);
973 else if (temp_vector.size() == 6 )
974 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_vector[0], temp_vector[1], temp_vector[2],
975 temp_vector[3], temp_vector[4], temp_vector[5] );
977 GiD_fEndResult(mResultFile);
988 const double SolutionTag
993 GiD_fBeginResult( mResultFile, (
char*)(rVariable.
Name().c_str()),
"Kratos",
994 SolutionTag, GiD_Matrix,
995 GiD_OnNodes, NULL, NULL, 0, NULL );
996 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
998 const Matrix& temp_matrix = it_node->GetValue(rVariable);
999 if (temp_matrix.size1() ==3 && temp_matrix.size2() ==3)
1001 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(1,1),
1002 temp_matrix(2,2), temp_matrix(0,1), temp_matrix(1,2),
1005 else if (temp_matrix.size1() ==2 && temp_matrix.size2() ==2)
1007 GiD_fWrite2DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(1,1), temp_matrix(0,1));
1010 else if (temp_matrix.size1() ==1 && temp_matrix.size2() ==3)
1013 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(0,1), 0.00,
1014 temp_matrix(0,2), 0.00, 0.00);
1016 else if (temp_matrix.size1() ==1 && temp_matrix.size2() ==6)
1018 GiD_fWrite3DMatrix( mResultFile, it_node->Id(), temp_matrix(0,0), temp_matrix(0,1), temp_matrix(0,2),
1019 temp_matrix(0,3), temp_matrix(0,4), temp_matrix(0,5) );
1023 GiD_fEndResult(mResultFile);
1031 const double SolutionTag
1036 GiD_fBeginResult( mResultFile, (
char*)(rVariable.Name().c_str()),
"Kratos",
1037 SolutionTag, GiD_LocalAxes,
1038 GiD_OnNodes, NULL, NULL, 0, NULL );
1040 for (
auto it_node = rNodes.
begin(); it_node != rNodes.
end() ; ++it_node)
1043 GiD_fWriteLocalAxes( mResultFile, it_node->Id(),
temp[0],
temp[1],
temp[2] );
1045 GiD_fEndResult(mResultFile);
1058 if ( mMode == GiD_PostAscii && ! mMeshFileOpen )
1061 file_name << std::setprecision(12) << mMeshFileName <<
"_" << name <<
".post.msh";
1062 mMeshFile = GiD_fOpenPostMeshFile( (
char *)(
file_name.str()).c_str(), mMode);
1063 mMeshFileOpen =
true;
1065 if ( (mMode == GiD_PostBinary || mMode == GiD_PostHDF5) && ! mResultFileOpen )
1068 file_name << std::setprecision(12) << mResultFileName <<
"_" << name <<
".post.bin";
1069 if ( ! mResultFileOpen )
1071 mResultFile = GiD_fOpenPostResultFile((
char*)(
file_name.str()).c_str(), mMode);
1072 mResultFileOpen =
true;
1074 mMeshFile = mResultFile;
1079 if ( (mMode == GiD_PostBinary || mMode == GiD_PostHDF5) && ! mResultFileOpen )
1082 file_name << mResultFileName <<
".post.bin";
1083 mResultFile = GiD_fOpenPostResultFile((
char*)(
file_name.str()).c_str(), mMode);
1084 if ( mResultFile == 0)
1086 std::stringstream buffer;
1087 buffer <<
"error opening results file:" <<
"/" <<
file_name.str() <<
"/";
1090 mResultFileOpen =
true;
1091 mMeshFile = mResultFile;
1093 if ( mMode == GiD_PostAscii && ! mMeshFileOpen )
1096 file_name << mMeshFileName <<
".post.msh";
1097 mMeshFile = GiD_fOpenPostMeshFile( (
char *)(
file_name.str()).c_str(), mMode);
1098 mMeshFileOpen =
true;
1108 if ( mUseMultiFile ==
MultipleFiles && mMode == GiD_PostAscii )
1110 GiD_fClosePostMeshFile(mMeshFile);
1111 mMeshFileOpen =
false;
1113 if ( mUseMultiFile ==
SingleFile && mMode == GiD_PostAscii )
1115 GiD_fClosePostMeshFile(mMeshFile);
1116 mMeshFileOpen =
false;
1134 GiD_fBeginMesh(mMeshFile,
"Kratos Mesh",GiD_3D,GiD_Point,1);
1135 GiD_fBeginCoordinates(mMeshFile);
1136 for (
auto node_iterator = rThisMesh.
NodesBegin();
1137 node_iterator != rThisMesh.
NodesEnd();
1141 GiD_fWriteCoordinates(mMeshFile, node_iterator->Id(), node_iterator->X0(),
1142 node_iterator->Y0(), node_iterator->Z0() );
1144 GiD_fWriteCoordinates(mMeshFile, node_iterator->Id(), node_iterator->X(),
1145 node_iterator->Y(), node_iterator->Z() );
1147 KRATOS_ERROR <<
"Undefined WriteDeformedMeshFlag" << std::endl;
1149 GiD_fEndCoordinates(mMeshFile);
1151 GiD_fBeginElements(mMeshFile);
1153 for (
auto node_iterator = rThisMesh.
NodesBegin(); node_iterator != rThisMesh.
NodesEnd(); ++node_iterator)
1155 nodes_id[0] = node_iterator->Id();
1156 GiD_fWriteElement(mMeshFile,node_iterator->Id(), nodes_id);
1158 GiD_fEndElements(mMeshFile);
1159 GiD_fEndMesh(mMeshFile);
1172 GiD_fBeginMesh(mMeshFile,
"Kratos Mesh",GiD_3D,GiD_Sphere,1);
1173 GiD_fBeginCoordinates(mMeshFile);
1174 for (
auto node_iterator = rThisMesh.
NodesBegin(); node_iterator != rThisMesh.
NodesEnd(); ++node_iterator)
1177 GiD_fWriteCoordinates( mMeshFile, node_iterator->Id(), node_iterator->X0(),
1178 node_iterator->Y0(), node_iterator->Z0() );
1180 GiD_fWriteCoordinates( mMeshFile, node_iterator->Id(), node_iterator->X(),
1181 node_iterator->Y(), node_iterator->Z() );
1183 KRATOS_ERROR <<
"Undefined WriteDeformedMeshFlag" << std::endl;
1185 GiD_fEndCoordinates( mMeshFile );
1187 GiD_fBeginElements( mMeshFile );
1193 for (
auto element_iterator = rThisMesh.
ElementsBegin(); element_iterator != rThisMesh.
ElementsEnd(); ++element_iterator)
1195 const unsigned int node_id = element_iterator->GetGeometry()[0].Id();
1196 GiD_fWriteSphereMat(mMeshFile,
node_id,
node_id, element_iterator->GetGeometry()[0].FastGetSolutionStepValue(
radius), element_iterator->GetGeometry()[0].FastGetSolutionStepValue(particle_material));
1198 GiD_fEndElements( mMeshFile );
1199 GiD_fEndMesh( mMeshFile);
1211 GiD_fBeginMesh(mMeshFile,
"Kratos Mesh",GiD_2D,GiD_Circle,1);
1212 GiD_fBeginCoordinates(mMeshFile);
1213 for (
auto node_iterator = rThisMesh.
NodesBegin(); node_iterator != rThisMesh.
NodesEnd(); ++node_iterator)
1216 GiD_fWriteCoordinates( mMeshFile, node_iterator->Id(), node_iterator->X0(),
1217 node_iterator->Y0(), node_iterator->Z0() );
1219 GiD_fWriteCoordinates( mMeshFile, node_iterator->Id(), node_iterator->X(),
1220 node_iterator->Y(), node_iterator->Z() );
1222 KRATOS_ERROR <<
"Undefined WriteDeformedMeshFlag" << std::endl;
1224 GiD_fEndCoordinates( mMeshFile );
1226 GiD_fBeginElements( mMeshFile );
1236 for (
auto node_iterator = rThisMesh.
NodesBegin(); node_iterator != rThisMesh.
NodesEnd(); ++node_iterator)
1238 nodes_id[0] = node_iterator->Id();
1239 GiD_fWriteCircleMat(mMeshFile, node_iterator->Id(), nodes_id[0], node_iterator->FastGetSolutionStepValue(
radius),
nx,
ny,
nz, node_iterator->FastGetSolutionStepValue(particle_material));
1241 GiD_fEndElements( mMeshFile );
1242 GiD_fEndMesh( mMeshFile);
1254 GiD_fBeginMesh(mMeshFile,
"Kratos Mesh",GiD_3D,GiD_Cluster,1);
1255 GiD_fBeginCoordinates(mMeshFile);
1256 for (
auto node_iterator = rThisMesh.
NodesBegin(); node_iterator != rThisMesh.
NodesEnd(); ++node_iterator)
1259 GiD_fWriteCoordinates( mMeshFile, node_iterator->Id(), node_iterator->X0(),
1260 node_iterator->Y0(), node_iterator->Z0() );
1262 GiD_fWriteCoordinates( mMeshFile, node_iterator->Id(), node_iterator->X(),
1263 node_iterator->Y(), node_iterator->Z() );
1265 KRATOS_ERROR <<
"Undefined WriteDeformedMeshFlag" << std::endl;
1267 GiD_fEndCoordinates( mMeshFile );
1269 GiD_fBeginElements( mMeshFile );
1274 for (
auto element_iterator = rThisMesh.
ElementsBegin(); element_iterator != rThisMesh.
ElementsEnd(); ++element_iterator)
1276 const unsigned int node_id = element_iterator->GetGeometry()[0].Id();
1277 GiD_fWriteClusterMat(mMeshFile,
node_id,
node_id, element_iterator->GetGeometry()[0].FastGetSolutionStepValue(particle_material));
1279 GiD_fEndElements( mMeshFile );
1280 GiD_fEndMesh( mMeshFile);
1303 for (
auto element_iterator = rThisMesh.
ElementsBegin(); element_iterator != rThisMesh.
ElementsEnd(); ++element_iterator)
1304 for (
auto it = mGidMeshContainers.begin(); it != mGidMeshContainers.end(); it++ )
1305 if ( it->AddElement( element_iterator ) )
1310 for (
auto conditions_iterator = rThisMesh.
ConditionsBegin(); conditions_iterator != rThisMesh.
ConditionsEnd(); conditions_iterator++ )
1311 for (
auto it = mGidMeshContainers.begin(); it != mGidMeshContainers.end(); it++ )
1312 if ( it->AddCondition( conditions_iterator ) )
1316 for (
auto it = mGidMeshContainers.begin(); it != mGidMeshContainers.end(); it++ )
1318 it->FinalizeMeshCreation();
1320 it->WriteMesh(mMeshFile,
true);
1322 it->WriteMesh(mMeshFile,
false);
1324 KRATOS_ERROR <<
"Undefined WriteDeformedMeshFlag" << std::endl;
1344 const std::string& rFlagName,
1346 const double SolutionTag
1351 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1352 it->PrintFlagsResults( mResultFile, rFlag, rFlagName, rModelPart, SolutionTag );
1366 const double SolutionTag,
const int ValueIndex = 0 )
1372 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1373 it->PrintResults( mResultFile, rVariable, rModelPart, SolutionTag, ValueIndex );
1389 const double SolutionTag,
1390 const int ValueIndex = 0
1397 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1398 it->PrintResults( mResultFile, rVariable, rModelPart, SolutionTag, ValueIndex );
1414 const double SolutionTag,
1415 const int ValueIndex = 0
1422 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1423 it->PrintResults( mResultFile, rVariable, rModelPart, SolutionTag, ValueIndex );
1439 const double SolutionTag,
1440 const int ValueIndex = 0
1447 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1448 it->PrintResults( mResultFile, rVariable, rModelPart, SolutionTag, ValueIndex );
1464 const double SolutionTag,
1465 const int ValueIndex = 0
1471 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1472 it->PrintResults( mResultFile, rVariable, rModelPart, SolutionTag, ValueIndex );
1488 const double SolutionTag,
1489 const int ValueIndex = 0
1495 for (
auto it = mGidGaussPointContainers.begin(); it != mGidGaussPointContainers.end(); it++ ) {
1496 it->PrintResults( mResultFile, rVariable, rModelPart, SolutionTag, ValueIndex );
1551 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
@ Kratos_Quadrilateral2D8
@ Kratos_Quadrilateral3D8
@ Kratos_Quadrilateral2D9
@ Kratos_Quadrilateral3D4
@ Kratos_Quadrilateral3D9
@ Kratos_Quadrilateral2D4
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
Base class for GidIO.
Definition: gid_io.h:74
void SetData(int data)
Definition: gid_io.cpp:39
GidIOBase()
Definition: gid_io.h:83
int data
Definition: gid_io.h:80
int GetData()
Definition: gid_io.cpp:35
static GidIOBase & GetInstance()
Definition: gid_io.cpp:22
This class defines an interface to the GiDPost library in order to provide GiD compliant I/O function...
Definition: gid_io.h:112
void WriteNodeMesh(MeshType &rThisMesh) override
Definition: gid_io.h:1128
std::string mResultFileName
Definition: gid_io.h:1508
WriteDeformedMeshFlag mWriteDeformed
Definition: gid_io.h:1517
GeometryData::KratosGeometryFamily KratosGeometryFamily
Geometry family definition.
Definition: gid_io.h:132
void WriteNodalResultsNonHistorical(Variable< Matrix > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:985
void Flush()
Definition: gid_io.h:530
MultiFileFlag mUseMultiFile
Definition: gid_io.h:1519
void WriteNodalResultsNonHistorical(Variable< bool > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:870
void InitializeMesh(const double name)
mesh writing functions
Definition: gid_io.h:1054
std::string mMeshFileName
Definition: gid_io.h:1509
virtual void InitializeResults(const double name, const MeshType &rThisMesh)
result functions
Definition: gid_io.h:566
void PrintFlagsOnGaussPoints(const Kratos::Flags &rFlag, const std::string &rFlagName, const ModelPart &rModelPart, const double SolutionTag)
functions for printing results on gauss points
Definition: gid_io.h:1342
void ChangeOutputName(const std::string &rDatafilename)
General GidIO related functions ///.
Definition: gid_io.h:498
void WriteNodalResults(Variable< double > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
functions for writing nodal results
Definition: gid_io.h:666
void FinalizeMesh()
Definition: gid_io.h:1106
IO BaseType
Base class definition.
Definition: gid_io.h:121
void WriteNodalResultsNonHistorical(Variable< double > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
functions for writing nodal results
Definition: gid_io.h:891
void WriteNodalResults(Variable< Vector > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
Definition: gid_io.h:740
void WriteClusterMesh(const MeshType &rThisMesh)
Definition: gid_io.h:1248
void WriteNodalResults(Variable< int > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
Definition: gid_io.h:688
ModelPart::ElementsContainerType ElementsArrayType
Containers definition.
Definition: gid_io.h:124
~GidIO() override
Destructor.
Definition: gid_io.h:177
GiD_PostMode mMode
Definition: gid_io.h:1520
virtual void PrintOnGaussPoints(const Variable< bool > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const int ValueIndex=0)
Definition: gid_io.h:1363
bool mResultFileOpen
Definition: gid_io.h:1528
ModelPart::NodesContainerType NodesArrayType
Definition: gid_io.h:125
std::vector< TMeshContainer > mGidMeshContainers
Definition: gid_io.h:1525
void WriteNodalResults(Variable< Matrix > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
Definition: gid_io.h:770
void WriteNodalResults(Variable< array_1d< double, 3 > > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
Definition: gid_io.h:712
KRATOS_CLASS_POINTER_DEFINITION(GidIO)
Pointer definition of GidIO.
void WriteNodalFlags(const Kratos::Flags &rFlag, const std::string &rFlagName, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:847
void InitializeResultFile(std::string const &rResultFileName)
Definition: gid_io.h:510
virtual void PrintOnGaussPoints(const Variable< array_1d< double, 3 > > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const int ValueIndex=0)
Definition: gid_io.h:1436
bool mMeshFileOpen
Definition: gid_io.h:1527
virtual void SetUpGaussPointContainers()
Creates the gauss point containers for all different element types.
Definition: gid_io.h:300
GiD_FILE mMeshFile
Definition: gid_io.h:1511
void WriteMesh(MeshType &rThisMesh) override
Definition: gid_io.h:1295
void SetUpMeshContainers()
Creates the mesh containers for all different element types.
Definition: gid_io.h:221
GiD_FILE mResultFile
Definition: gid_io.h:1512
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: gid_io.h:126
virtual void PrintOnGaussPoints(const Variable< double > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const int ValueIndex=0)
Definition: gid_io.h:1411
void WriteSphereMesh(const MeshType &rThisMesh)
Definition: gid_io.h:1166
void CloseResultFile()
Definition: gid_io.h:518
std::string Info() const override
Definition: gid_io.h:539
WriteConditionsFlag mWriteConditions
Definition: gid_io.h:1518
void WriteNodalResultsNonHistorical(Variable< int > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:911
GidIO(const std::string &rDatafilename, const GiD_PostMode Mode, const MultiFileFlag UseMultipleFilesFlag, const WriteDeformedMeshFlag WriteDeformedFlag, const WriteConditionsFlag WriteConditions, const bool InitializeGaussPointContainers=true)
Constructor. Single stream IO constructor.
Definition: gid_io.h:145
void PrintInfo(std::ostream &rOStream) const override
Definition: gid_io.h:547
virtual void PrintOnGaussPoints(const Variable< int > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const int ValueIndex=0)
Definition: gid_io.h:1386
void WriteCircleMesh(const MeshType &rThisMesh)
Definition: gid_io.h:1206
void WriteNodalResults(Variable< bool > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
functions for writing nodal results
Definition: gid_io.h:642
void WriteLocalAxesOnNodesNonHistorical(Variable< array_1d< double, 3 > > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:1028
void PrintData(std::ostream &rOStream) const override
Definition: gid_io.h:555
virtual void PrintOnGaussPoints(const Variable< Vector > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const int ValueIndex=0)
Definition: gid_io.h:1461
virtual void PrintOnGaussPoints(const Variable< Matrix > &rVariable, const ModelPart &rModelPart, const double SolutionTag, const int ValueIndex=0)
Definition: gid_io.h:1485
std::vector< TGaussPointContainer > mGidGaussPointContainers
Definition: gid_io.h:1526
void WriteLocalAxesOnNodes(Variable< array_1d< double, 3 > > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag, const std::size_t SolutionStepNumber)
Definition: gid_io.h:816
void WriteNodalResultsNonHistorical(Variable< array_1d< double, 3 > > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:932
void FinalizeResults()
Definition: gid_io.h:618
void WriteNodalResultsNonHistorical(Variable< Vector > const &rVariable, const NodesContainerType &rNodes, const double SolutionTag)
Definition: gid_io.h:957
GeometryData::IntegrationMethod IntegrationMethodType
Integration method definition.
Definition: gid_io.h:129
IO provides different implementation of input output procedures which can be used to read and write w...
Definition: io.h:58
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
Mesh is the second level of abstraction in the data structure which hold Nodes, Elements and Conditio...
Definition: mesh.h:69
ElementIterator ElementsEnd()
Definition: mesh.h:558
ElementIterator ElementsBegin()
Definition: mesh.h:548
ConditionIterator ConditionsBegin()
Definition: mesh.h:671
NodeIterator NodesEnd()
Definition: mesh.h:336
NodeIterator NodesBegin()
Definition: mesh.h:326
ConditionIterator ConditionsEnd()
Definition: mesh.h:681
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::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
iterator end()
Returns an iterator pointing to the end of the container.
Definition: pointer_vector_set.h:314
static void Start(std::string const &rIntervalName)
This method starts the timer meassures.
Definition: timer.cpp:109
static void Stop(std::string const &rIntervalName)
This method stops the timer meassures.
Definition: timer.cpp:125
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_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_API_EXTERN
Definition: kratos_export_api.h:57
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
WriteDeformedMeshFlag
Flags for mesh writing.
Definition: gid_io.h:52
@ WriteUndeformed
Definition: gid_io.h:52
@ WriteDeformed
Definition: gid_io.h:52
MultiFileFlag
Definition: gid_io.h:54
@ MultipleFiles
Definition: gid_io.h:54
@ SingleFile
Definition: gid_io.h:54
WriteConditionsFlag
Definition: gid_io.h:53
@ WriteConditions
Definition: gid_io.h:53
@ WriteElementsOnly
Definition: gid_io.h:53
@ WriteConditionsOnly
Definition: gid_io.h:53
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
ny
Definition: cube_mesher.py:738
nz
Definition: cube_mesher.py:739
nx
Definition: cube_mesher.py:737
float radius
Definition: mesh_to_mdpa_converter.py:18
data
Definition: mesh_to_mdpa_converter.py:59
int node_id
Definition: read_stl.py:12
float temp
Definition: rotating_cone.py:85
string file_name
Definition: sp_statistics.py:6