GiD - The personal pre and post processor

Using the library

C / C++ language:

Include the file header file gidpost.h to use the libray gidpost

#include "gidpost.h"


Small examples:

  • testpost.c, is provided to show the use of the library from C/C++.
  • testpost_fd.c that use the *f functions where the file handler is explicitly specified (to allow multiple files)
  • IGA_test_1.c, to show the use of OnNurbsSurface isogeometric results

FORTRAN language:


A small example, called testpostfor.f, is provided to show the use of the library with FORTRAN 77
the same case is implemented with FORTRAN 90 in the example testpost.f90, using the gidpost.F90 interface module


Note: The gidpost fortran 90 module use the new ISO_C_BINDING intrinsic module defined in the Fortran 2003 standard.
(Tested in intel fortran >= 10.1, Sun/Oracle studio >= 12.1, and GNU gfortran >= XX)


Link libraries: gidpost.lib zlib.lib hdf5.lib (Linker - Input - Additional Dependencies)
and remember set the path to these libraries (e.g. Linker - General - Additional Library Directories - ..\..\binaries\win\x32)


Note: the hdf5.lib library is only required to write files with HDF5 format.
Note: For Linux platforms the extension of libraries is .a instead of .lib


Python module:

Inside the folder gidpost/gidpost-swig there are a couple of examples on how to use gidpost python module.

Once the module has been built and installed, then you can use it like this:

gidpost_test.py
$ python3
Type "help", "copyright", "credits" or "license" for more information.
>>> import gidpost
gidpost.GiD_PostInit()
file_id = gidpost.GiD_fOpenPostResultFile( "gidpost-test-array.post.h5", gidpost.GiD_PostHDF5)

# Create mesh with num_nodes, num_triangles and num_quads
# coords_list_ids = array with the id's of the nodes ( gidpost.new_intArray(...))
# coords_list_xyz = array with the x y z coordinades of the nodes x1 y1 z1 x2 y2 z2 .... ( gidpost.new_doubleArray(...))
# triangs_list_ids = array with the id's of the triangles
# triangs_connectivities = array with the connectivities of the triangles
# quads_list_ids = array with the id's of the triangles
# quads_connectivities = array with the connectivities of the triangles

gidpost.GiD_fBeginMeshColor( file_id, "test gp_py triangles", gidpost.GiD_3D, gidpost.GiD_Triangle, 3, 0.6, 0.5, 0.4)
fail = gidpost.GiD_fWriteCoordinatesIdBlock( file_id, num_nodes, coords_list_ids, coords_list_xyz)
fail = gidpost.GiD_fWriteElementsIdBlock( file_id, num_triangles, triangs_list_ids, triangs_connectivities)

gidpost.GiD_fBeginMeshColor( file_id, "test gp_py quadrilaterals", gidpost.GiD_3D, gidpost.GiD_Quadrilateral, 4, 0.8, 0.2, 0.5)
fail = gidpost.GiD_fWriteElementsIdBlock( file_id, num_quads, quads_list_ids, quads_connectivities)

# Create results
# scalar_nodes = array of a scalar result for all nodes
# elements_list_ids = array with the id's of the elements
# scalar_elemental = array of a elemental result for all elements

list_comp_names = gidpost.new_stringArray( 0);
fail = gidpost.GiD_fWriteResultBlock( file_id, "test nodal", "gidpost", 1.0, 
                                     gidpost.GiD_Scalar, gidpost.GiD_OnNodes, "", "", 0, list_comp_names, 
                                     num_nodes, coords_list_ids, 1, scalar_nodes)

fail = gidpost.GiD_fWriteResultBlock( file_id, "test elemental", "gidpost", 1.0, 
                                     gidpost.GiD_Scalar, gidpost.GiD_OnGaussPoints, "GP_ELEMENT_1", "", 0, list_comp_names, 
                                     num_elements, elements_list_ids, 1, scalar_elemental)

fail = gidpost.GiD_fClosePostResultFile( file_id)
fail = gidpost.GiD_PostDone()

gidpost.delete_intArray( coords_list_ids)
gidpost.delete_intArray( triangs_list_ids)
gidpost.delete_intArray( triangs_connectivities)
gidpost.delete_intArray( quads_list_ids)
gidpost.delete_intArray( quads_connectivities)
gidpost.delete_intArray( elements_list_ids)

gidpost.delete_doubleArray( coords_list_xyz)
gidpost.delete_doubleArray( scalar_nodes)
gidpost.delete_doubleArray( scalar_elemental)




COPYRIGHT © 2022 · GID · CIMNE