Introduction |
gidpost is a set of functions (library) for writing postprocess results for GiD in ASCII or binary format. GiD version 6.1.4b or higher is required to read the ASCII postprocess files. GiD version 7.2 or higher is required to read the binaries postprocess files.
This software is copyrighted by CIMNE
gid.cimne.upc.es,
(Visit GiD). The software can be used
freely under the terms described in license.terms, all terms described
there apply to all files associated with the software unless
explicitly disclaimed in individual files. Particular terms apply to the third party
code, "cfortran.h", which has its own distribution policy
(please read the "cfortran.doc" for this code).
This
description asumes that the readear is familiar with the postprocess
terminology.
For futher details please check the online help
available in GiD ( Postprocess
data files chapter).
The library was implemented taking into account two of the must widely
used development environments: C/C++ and FORTRAN.
Here we are going to describe how to compile and use the library. At
the end the reference of the library functions can be found.
Compiling |
makefile is provided inside the unix directory. Invoke make
to create the library:
make [target=release|debug]This will create the library
unix/release/gidpost.a if the option is target=release
or unix/debug/gidpostd.a if the option istarget=debug. If no option is provided
the release version is created by default. Makefile.vc is provided inside gidpost\\winto compile with Microsoft Visual C++.
To compile, open a DOS console, change the current directory to gidpost\\win.
First run vcvars32.bat prior namake execution to ensure enviroment PATH is ok. Then
invoke:
nmake -f Makefile.vc [CFG="Release"|"Debug"]This will create the library
gidpost.lib inside the subdirectory win\\Release
if the option is CFG="Release" or inside win\\Debug) if the option is
CFG="Debug". If no option is provided the release version is created by default.cfortran.h", is also provided as a link between C and FORTRAN. It has
its own distribution policy. Please, read the file "cfortran.doc" about the licence terms of
this code.
Using the library |
gidpost.h to use the libray gidpost
#include "gidpost.h"A small example, called
testpost.c, is provided to show the use of the library from C/C++.testpostfor.f, is provided to show the use of the library with FORTRAN
Functions references |
int GiD_OpenPostMeshFile(char* FileName,GiD_PostMode Mode); Description: Open a new post mesh file Parameters:
GiD_WriteCoordinates2D
Parameters:
int id
Node number identifier (starting from 1, is recommended to avoid jumps in the
numeration)
double x,double y,double z
Cartesian coordinates
Example:
C/C++
int id=1;
double x=3.5,y=1.5e-2,z=0;
GiD_WriteCoordinates(id,x,y,z);
FORTRAN
REAL*8 rx, ry
INTEGER*4 idx
idx=1
rx=3.5
ry=-4.67
CALL GID_WRITECOORDINATES(idx,rx,ry,0.0)
int GiD_BeginElements();
Description: Start a elements block in the current mesh.
Parameters:
None
Example:
C/C++
GiD_BeginElements();
FORTRAN
CALL GID_BEGINELEMENTS
int GiD_EndElements();
Description: Close the current elements block.
Parameters:
None
Example:
C/C++
GiD_EndElements();
FORTRAN
CALL GID_ENDELEMENTS
int GiD_WriteElement(int id,int nid[]);
Description: Write an element member at the current Elements Block.
Parameters:
int id
Element number identifier
int nid[]
connectivities of the element, the vector dimension must be equal to the
NNode parameter given in the previous call to GiD_BeginMesh
Example:
C/C++
int id=2;
int nid[3];
nid[0]=4; nid[1]=7; nid[2]=3;
GiD_WriteElementMat(id,nid);
FORTRAN
INTEGER *4 nid(1:3)
INTEGER*4 idx
idx=2
nid(1)=4
nid(2)=7
nid(3)=3
CALL GID_WRITEELEMENT(idx,nid)
int GiD_WriteElementMat(int id,int nid[]);
Description: Similar to GiD_WriteElement, but the last aditional integer
on nid correspond to a material number.
Results file functions
int GiD_OpenPostResultFile(char* FileName,GiD_PostMode Mode);
Description: Open a new post result file. All subsequent call to
functions write the information into this file. If there is no mesh file opened
then the output of the mesh is writen into this file also.
Parameters:
char* FileName
name of the mesh file (*.flavia.res)
GiD_PostMode Mode
GiD_PostAscii=0 for ascii output
GiD_PostAsciiZipped=1 for compressed ascii output
GiD_PostBinary=2 for compressed binary output
Note: In binary output, the mesh must be inside the same file as the results,
you should not call GiD_OpenPostMeshFile and GiD_ClosePostMeshFile in
that case.
Example:
C/C++
GiD_OpenPostResultFile( "testpost.bin",GiD_PostBinary);
FORTRAN
CALL GID_OPENPOSTRESULTFILE('testfortran.flavia.res',2)
int GiD_ClosePostResultFile();
Description: Close the current post results file
Parameters:
None
Example:
C/C++
GiD_ClosePostResultFile();
FORTRAN
CALL GID_CLOSEPOSTRESULTFILE
int GiD_BeginGaussPoint(char* name,GiD_ElementType EType,char* MeshName,
int GP_number,int NodesIncluded,int InternalCoord);
Description: Begin Gauss Points definition. The gauss point definition
should have a name wich may be referenced in futher results blocks. The gauss
points could be internal (InternalCoord=1) or given (InternalCoord=0). If the
gauss points are given then the list of its natural coordinates should be
written using the function GiD_WriteGaussPoint2D or GiD_WriteGaussPoint3D
depending on the dimension of the element type.
Parameters:
char* name
Name to reference this gauss points definition
GiD_ElementType EType
GiD_Point=1 for a 1 noded-element
GiD_Linear=2 for a line element
GiD_Triangle=3 for a triangle element
GiD_Quadrilateral=4 for a quadrilateral element
GiD_Tetrahedra=5 for a tetrahedral element
GiD_Hexahedra=6 for a hexahedral element
GiD_Prism=7 for a prism element
char* MeshName
An optional field. If this field is missing, the gauss points are defined
for all the elements of type my_type. If a mesh name is given, the gauss
points are only defined for this mesh.
int GP_number
number of gauss points per element. The GiD internal accepted number
should be:
1, 3, 6 for Triangles;
1, 4, 9 for quadrilaterals;
1, 4 for Tetrahedras;
1, 8, 27 for hexahedras;
1 or 6 for prism and
1, ... n points equally spaced over lines.
int NodesIncluded
Can be 0 for nodes not included or 1 for included. Only used for gauss
points on Linear elements which indicate whether the end nodes of the
Linear element are included in the number of gauss points per element
count or not.
int InternalCoord
Can be 0 for given coordinates or 1 for internal GiD gauss
points location.
Example:
C/C++
GiD_BeginGaussPoint("GPtria",GiD_Triangle,NULL,1,0,1);
FORTRAN
CHARACTER*4 NULL
NULL = CHAR(0)//CHAR(0)//CHAR(0)//CHAR(0)
CALL GID_BEGINGAUSSPOINT('GPtria',3,NULL,1,0,1);
int GiD_EndGaussPoint();
Description: End current Gauss Points definition
Parameters:
None
Example:
C/C++
GiD_EndGaussPoint();
FORTRAN
CALL GID_ENDGAUSSPOINT
int GiD_WriteGaussPoint2D(double x,double y);
int GiD_WriteGaussPoint3D(double x,double y,double z);
Description: Write internal gauss point local coordinates (only required
if InternalCoord=0)
Parameters:
double x,double y,double z
Cartesian gauss points local coordinates
Example:
C/C++
double x=3.5;
double y=-7;
GiD_WriteGaussPoint2D(double x,double y);
FORTRAN
REAL*8 x, y
rx=3.5
ry=-7
CALL GID_WRITEGAUSSPOINT2D(x,y)
int GiD_BeginRangeTable(char* name);
Description: Begin a Range Table definition. With a range table you can
group the result values into intervals and label each interval with a name.
Inside GiD this can be visualized with a contour range.
Parameters:
char* name
name identifier
Example:
C/C++
GiD_BeginRangeTable("table1");
FORTRAN
CALL GID_BEGINRANGETABLE('table1')
int GiD_EndRangeTable();
Description: End a Range Table definition.
Parameters:
None
Example:
C/C++
GiD_EndRangeTable();
FORTRAN
CALL GID_ENDRANGETABLE()
int GiD_WriteMinRange(double max,char* name);
int GiD_WriteRange(double min,double max,char* name);
int GiD_WriteMaxRange(double min,char* name);
Description: Write Range functions. Must be between GiD_BeginRangeTable
and GiD_EndRangeTable.
WriteMinRange : write a range with an implicit minimum value,
the minimum absolute in the result set.
WriteRange : write an explicit range.
WritemaxRange: write a range with an implicit maximum value,
the maximum absolute in the result set.
Parameters:
double min,double max
Values to define a interval
char* name
string asociated to be showed for this interval
Example:
C/C++
GiD_WriteRange(0.0,100.0,"Normal");
FORTRAN
CALL GID_WRITERANGE(0.0,100.0,'Normal')
int GiD_BeginResult(char* Result,char* Analysis,double step,
GiD_ResultType Type,GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
int compc,char* compv[]);
Description: Begin Result Block. This function open a result block.
Parameters:
char* Result
a name for the Result, which will be used for menus.
char* Analysis
the name of the analysis of this Result, which will be used for menus.
double step
the value of the time step inside the analysis "analysis name".
(for multiple steps results)
GiD_ResultType Type
The type of defined result:
GiD_Scalar=0
GiD_Vector=1
GiD_Matrix=2
GiD_PlainDeformationMatrix=3
GiD_MainMatrix=4
GiD_LocalAxes=5
GiD_ResultLocation Where
The location of the results
GiD_OnNodes=0
GiD_OnGaussPoints=1
char* GaussPointsName
If Where is GiD_OnGaussPoints a "location name" (predefined in
GiD_BeginGaussPoint) should be entered.
char* RangeTable
A valid Range table name or NULL
int compc
The number of component names or 0
char* compv[]
array of 'compc' strings to be used as component names
Note: in FORTRAN, instead of a general GID_BEGINRESULT, must be used a separate
function foreach result type:
int GiD_BeginScalarResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,
char* RangeTable,char* Comp);
int GiD_BeginVectorResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
char* Comp1,char* Comp2,char* Comp3,char* Comp4);
int GiD_Begin2DMatResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
char* Comp1,char* Comp2,char* Comp3);
int GiD_Begin3DMatResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
char* Comp1,char* Comp2,char* Comp3,
char* Comp4,char* Comp5,char* Comp6);
int GiD_BeginPDMMatResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
char* Comp1,char* Comp2,char* Comp3,
char* Comp4);
int GiD_BeginMainMatResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
char* Comp1,char* Comp2,char* Comp3,
char* Comp4,char* Comp5,char* Comp6,
char* Comp7,char* Comp8,char* Comp9,
char* Comp10,char* Comp11,char* Comp12);
int GiD_BeginLAResult(char* Result,char* Analysis,float step,
GiD_ResultLocation Where,
char* GaussPointsName,char* RangeTable,
char* Comp1,char* Comp2,char* Comp3);
Example:
C/C++
GiD_BeginResult("Result","Static",1.0,GiD_Scalar,GiD_OnNodes,NULL,NULL,0,NULL);
FORTRAN
CHARACTER*4 NULL
NULL = CHAR(0)//CHAR(0)//CHAR(0)//CHAR(0)
CALL GID_BEGINSCALARRESULT('Result','Analy.',1.0,0,NULL,NULL,NULL)
int GiD_BeginResultHeader(char * Result, char * Analysis, double step,
GiD_ResultType Type, GiD_ResultLocation Where,
char * GaussPointsName);
Description:
Begin Result Block. This function open a result block. Only the result,
analisys, location and location name are provided in the function call. The
other result attributes as range table or components names are provided in a
separated function calls. See GiD_ResultRange and GiD_ResultComponents.
Parameters:
See GiD_BeginResult.
Example:
GiD_BeginHeader("Result","Static",1.0,GiD_Scalar,GiD_OnNodes,NULL);
int GiD_ResultRange(char * RangeTable);
Description:
Define the components names associated to the current result, either a single
result block or the current result defined in a result group.
Parameters:
char * RangeTable --> name of the range table previously defined
Example:
C/C++
GiD_ResultRange("MyTable");
FORTRAN
GID_RESULTRANGE('MyTable');
int GiD_ResultComponents(int compc, char* compv[]);
Description: Define the components names associated to the current
result, either a single result block or the current result defined in a result
group. In FORTRAN you should call a diferent function of each result type:
GID_SCALARCOMP(STRING Comp1) --> for scalar result
GID_VECTORCOMP(STRING Comp1, STRING Comp2,
STRING Comp3, STRING Comp4) --> for vector result type
GID_2DMATRIXCOMP(STRING Sxx, STRING Syy, STRING Sxy) --> for matrix result type
GID_3DMATRIXCOMP(STRING Sxx, STRING Syy, STRING Szz,
STRING Sxy, STRING Syz, STRING Sxz) --> for matrix result type
GID_PDMCOMP(STRING Sxx, STRING Syy, STRING Sxy,
STRING Szz); --> for plain deformation matrix result type
GID_MAINMATRIXCOMP(STRING Si, STRING Sii, STRING Siii,
STRING Vix, STRING Viy, STRING Viz,
STRING Viix, STRING Viiy, STRING Viiz,
STRING Viiix, STRING Viiiy, STRING Viiiz) --> for main matrix result type
GID_LACOMPONENT(STRING axes_1, STRING axes_2, STRING axes_3) --> for local axis result type
Parameters:
int compc --> number of components names to write.
char * compv[] --> array of names.
Example:
C/C++
char cnames[] = {"X", "Y", "Z", "Mod"};
Gid_ResultComponents(3, cnames);
FORTRAN
CHARACTER*10 XN, YN, ZN, MN
XN = 'X'
YN = 'Y'
ZN = 'Z'
MN = 'Mod'
CALL GID_VECTORCOMP(XN, YN, ZN, MN)
int GiD_BeginResultGroup(char * Analysis, double step, GiD_ResultLocation Where,
char * GaussPointsName);
Description: Begin a result group. All grouped in the same analysis and
step. See GiD online help on this topic.
Parameters:
See GiD_BeginResult.
Example:
C/C++
GiD_BeginResultGroup("Analysis", 1.0, GiD_OnNodes, NULL);
GiD_ResultDescription("EscalarNodos", GiD_Scalar);
GiD_ResultDescription("VectorNodos", GiD_Vector);
GiD_ResultDescription("Matrix", GiD_Matrix);
GiD_ResultDescription("Local Axes", GiD_LocalAxes);
for ( i = 0; i < 9; i++ ) {
GiD_WriteScalar(nodes[i].id, Random());
GiD_WriteVector(nodes[i].id, Random(), Random(), Random());
GiD_Write3DMatrix(i+1, Random(), Random(), Random(),
Random(), Random(), Random());
GiD_WriteLocalAxes(i+1, Random(), Random(), Random());
}
GiD_EndResult();
FORTRAN
CALL GID_BEGINRESULTGROUP("Analysis", 1.0, 0, NULL)
CALL GID_RESULTDESCRIPTION("EscalarNodos", 0)
CALL GID_RESULTDESCRIPTION("VectorNodos",1)
CALL GID_RESULTDESCRIPTION("Matrix",2)
CALL GID_RESULTDESCRIPTION("Local Axes",5)
do idx=1,9
value = idx*1.5;
CALL GID_WRITESCALAR(nodes[i].id, value)
CALL GID_WRITEVECTOR(nodes[i].id, value, value*2, value*3)
CALL GID_WRITE3DMATRIX(i+1,value,value*2,value*3,value*4,value*7,value*1.1)
CALL GID_WRITELOCALAXES(i+1,value,value*3,value*5)
end do
GID_ENDRESULT();
int GiD_ResultDescription(char * Result, GiD_ResultType Type);
int GiD_ResultDescriptionDim( GP_CONST char * Result, GiD_ResultType Type, size_t dim);
Description: Define a result member of a result group given the name and
result type. The second prototype enable us to specify the dimension of
the result types. Most of the types do not allow more than one
dimension. Bellow if the set of valid dimensions for the argument dim given
the value of Type:
- Scalar : 1 (GiD_WriteScalar)
- Vector : 2 (GiD_Write2DVector), 3(GiD_WriteVector) or 4 (GiD_WriteVectorModule)
- Matrix : 3 (GiD_Write2DMatrix) or 6 (GiD_Write3DMatrix)
- PlainDeformationMatrix : 4 (GiD_WritePlainDefMatrix)
- MainMatrix : 12 (GiD_WriteMainMatrix)
- LocalAxes : 3 (GiD_WriteLocalAxes)
Parameters:
See GiD_BeginResult.
Example:
C/C++
See GiD_BeginResultGroup
FORTRAN
See GiD_BeginResultGroup
int GiD_ResultValues();
Description: This function is not needed anymore it is just maintained
for backward compatibility.
Parameters:
Example:
int GiD_EndResult();
Description: End Result Block.
Parameters:
NONE
Example:
C/C++
GiD_EndResult();
FORTRAN
CALL GID_ENDRESULT
int GiD_BeginOnMeshGroup(char * Name);
Description:
Results which are referred to a mesh group (see GiD_BeginMeshGroup) should be written between a call to this function and GiD_EndOnMeshGroup.
Parameters:
char* Name
Name of the mesh group where the results will be specified. This group must be previously defined in a call to GiD_BeginMeshGroup.
Example:
C/C++
GiD_BeginOnMeshGroup("steps 1, 2, 3 and 4" );
FORTRAN
CALL GID_BEGINONMESHGROUP("steps 1, 2, 3 and 4" )
int GiD_EndOnMeshGroup();
Description:
This function close a previously opened block of result over a mesh group. See GiD_BeginOnMeshGroup.
Parameters:
None
Example:
C/C++
GiD_EndOnMeshGroup();
FORTRAN
GID_ENDONMESHGROUP();
int GiD_FlushPostFile();
Description: Flushes all pending output into the postprocess file. This
function should be called only when strictly necessary when writing in
GiD_PostAsciiZipped or GiD_PostBinary modes because it can degrade compression.
Parameters:
None
Example:
C/C++
GiD_FlushPostFile();
FORTRAN
CALL GID_FLUSHPOSTFILE
int GiD_WriteScalar(int id,double v);
int GiD_Write2DVector(int id, double x, double y);
int GiD_WriteVector(int id,double x,double y,double z);
int GiD_WriteVectorModule(int id,double x,double y,double z,double mod);
int GiD_Write2DMatrix(int id,double Sxx,double Syy,double Sxy);
int GiD_Write3DMatrix(int id,double Sxx,double Syy,double Szz,
double Sxy,double Syz,double Sxz);
int GiD_WritePlainDefMatrix(int id,double Sxx,double Syy,double Sxy,double Szz);
int GiD_WriteMainMatrix(int id,
double Si,double Sii,double Siii,
double Vix,double Viy,double Viz,
double Viix,double Viiy,double Viiz,
double Viiix,double Viiiy,double Viiiz);
int GiD_WriteLocalAxes(int id,double euler_1,double euler_2,double euler_3);
Description:
Write result functions. Must be between GiD_BeginResult and GiD_EndResult
Parameters:
None
Example:
C/C++
GiD_WriteScalar(3,4.6);
FORTRAN
INTEGER*4 idx
REAL*8 value
idx=3
value=4.6
CALL GID_WRITESCALAR(idx,value)