lib_vtk_io.F

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\stbtel\lib_vtk_io.F
00002 !
00036                   MODULE LIB_VTK_IO
00037 !                 **********************
00038 !
00039 !***********************************************************************
00040 ! STBTEL   V6P3                                     06/2013
00041 !***********************************************************************
00042 !
00043 !
00044 !
00045 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00046 !|              |<-->|
00047 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00048 !
00049       IMPLICIT NONE
00050       PRIVATE
00051 #if defined(HAVE_VTK)
00052       ! FUNCTIONS FOR VTK LEGACY
00053       PUBLIC:: VTK_INI
00054       PUBLIC:: VTK_GEO
00055       PUBLIC:: VTK_CON
00056       PUBLIC:: VTK_DAT
00057       PUBLIC:: VTK_VAR
00058       PUBLIC:: VTK_END
00059       ! PORTABLE KIND-PRECISION
00060       PUBLIC:: R16P, FR16P
00061       PUBLIC:: R8P,  FR8P
00062       PUBLIC:: R4P,  FR4P
00063       PUBLIC:: R_P,  FR_P
00064       PUBLIC:: I8P,  FI8P
00065       PUBLIC:: I4P,  FI4P
00066       PUBLIC:: I2P,  FI2P
00067       PUBLIC:: I1P,  FI1P
00068       PUBLIC:: I_P,  FI_P
00069       !-----------------------------------------------
00070 
00071       !----------------------------------------------
00072       ! overloading of VTK_GEO
00073       INTERFACE VTK_GEO
00074         MODULE PROCEDURE VTK_GEO_UNST_R8,   ! REAL(R8P) UNSTRUCTURED_GRID
00075      &                   VTK_GEO_UNST_R4,   ! REAL(R4P) UNSTRUCTURED_GRID
00076      &                   VTK_GEO_STRP_R8,   ! REAL(R8P) STRUCTURED_POINTS
00077      &                   VTK_GEO_STRP_R4,   ! REAL(R4P) STRUCTURED_POINTS
00078      &                   VTK_GEO_STRG_R8,   ! REAL(R8P) STRUCTURED_GRID
00079      &                   VTK_GEO_STRG_R4,   ! REAL(R4P) STRUCTURED_GRID
00080      &                   VTK_GEO_RECT_R8,   ! REAL(R8P) RECTILINEAR_GRID
00081      &                   VTK_GEO_RECT_R4    ! REAL(R4P) RECTILINEAR_GRID
00082       END INTERFACE
00083       ! overloading of VTK_VAR
00084       INTERFACE VTK_VAR
00085         MODULE PROCEDURE VTK_VAR_SCAL_R8,   ! REAL(R8P)    SCALAR
00086      &                   VTK_VAR_SCAL_R4,   ! REAL(R4P)    SCALAR
00087      &                   VTK_VAR_SCAL_I4,   ! INTEGER(I4P) SCALAR
00088      &                   VTK_VAR_VECT_R8,   ! REAL(R8P)    VECTORIAL
00089      &                   VTK_VAR_VECT_R4,   ! REAL(R4P)    VECTORIAL
00090      &                   VTK_VAR_VECT_I4,   ! INTEGER(I4P) VECTORIAL
00091      &                   VTK_VAR_TEXT_R8,   ! REAL(R8P)    VECTORIAL (TEXTURE)
00092      &                   VTK_VAR_TEXT_R4    ! REAL(R4P)    VECTORIAL (TEXTURE)
00093       END INTERFACE
00094       !----------------------------------------------------------------------------------------------------------------------------------
00095 
00096       !----------------------------------------------------------------------------------------------------------------------------------
00097       !!\LIBVTKIO has a small set of internal variables and parameters some of which have public visibility.
00098       !!
00099       !!The \LIBVTKIO uses a partable kind parameters for real and integer variables. The following are the kind parameters used: these
00100       !!parameters are public and their use is strong encouraged.
00101       !!
00102       !!Real precision definitions:
00103       !!
00104       INTEGER, PARAMETER:: R16P = SELECTED_REAL_KIND(33,4931) ! 33  DIGITS, RANGE $[\PM 10^{-4931}  ,\PM 10^{+4931}   -1]$
00105       INTEGER, PARAMETER:: R8P  = SELECTED_REAL_KIND(15,307)  ! 15  DIGITS, RANGE $[\PM 10^{-307}~~ ,\PM 10^{+307}~~  -1]$
00106       INTEGER, PARAMETER:: R4P  = SELECTED_REAL_KIND(6,37)    ! 6~~~DIGITS, RANGE $[\PM 10^{-37}~~~~,\PM 10^{+37}~~~~ -1]$
00107       INTEGER, PARAMETER:: R_P  = R8P                         ! DEFAULT REAL PRECISION
00108       !!Integer precision definitions:
00109       !!
00110       INTEGER, PARAMETER:: I8P  = SELECTED_INT_KIND(18)       ! RANGE $[-2^{63} ,+2^{63}  -1]$
00111       INTEGER, PARAMETER:: I4P  = SELECTED_INT_KIND(9)        ! RANGE $[-2^{31} ,+2^{31}  -1]$
00112       INTEGER, PARAMETER:: I2P  = SELECTED_INT_KIND(4)        ! RANGE $[-2^{15} ,+2^{15}  -1]$
00113       INTEGER, PARAMETER:: I1P  = SELECTED_INT_KIND(2)        ! RANGE $[-2^{7}~~,+2^{7}~~ -1]$
00114       INTEGER, PARAMETER:: I_P  = I4P                         ! DEFAULT INTEGER PRECISION
00115       !!
00116       !!Besides the kind parameters there are also the format parameters useful for writing in a well-ascii-format numeric variables.
00117       !!Also these parameters are public.
00118       !!
00119       !! Real output formats:
00120       !!
00121       CHARACTER(10), PARAMETER:: FR16P = '(E41.33E4)'         ! R16P  OUTPUT FORMAT
00122       CHARACTER(10), PARAMETER:: FR8P  = '(E23.15E3)'         ! R8P   OUTPUT FORMAT
00123       CHARACTER(9),  PARAMETER:: FR4P  = '(E14.6E2)'          ! R4P   OUTPUT FORMAT
00124       CHARACTER(10), PARAMETER:: FR_P  = '(E23.15E3)'         ! R\_P  OUTPUT FORMAT
00125       !! Integer output formats:
00126       !!
00127       CHARACTER(5), PARAMETER:: FI8P  = '(I21)'               ! I8P  OUTPUT FORMAT
00128       CHARACTER(5), PARAMETER:: FI4P  = '(I12)'               ! I4P  OUTPUT FORMAT
00129       CHARACTER(4), PARAMETER:: FI2P  = '(I7)'                ! I2P  OUTPUT FORMAT
00130       CHARACTER(4), PARAMETER:: FI1P  = '(I5)'                ! I1P  OUTPUT FORMAT
00131       CHARACTER(5), PARAMETER:: FI_P  = '(I12)'               ! I\_P OUTPUT FORMAT
00132       !!
00133       !!\LIBVTKIO uses a small set of internal variables that are private (not accessible from the outside). The following are
00134       !! private variables:
00135       !!
00136       INTEGER(I4P), PARAMETER:: MAXLEN       = 500         ! MAX NUMBER OF CHARACTERS OS STATIC STRING
00137       CHARACTER(1), PARAMETER:: END_REC      = CHAR(10)    ! END-CHARACTER FOR BINARY-RECORD FINALIZE
00138       INTEGER(I4P), PARAMETER:: F_OUT_ASCII  = 0           ! ASCII-OUTPUT-FORMAT PARAMETER IDENTIFIER
00139       INTEGER(I4P), PARAMETER:: F_OUT_BINARY = 1           ! BINARY-OUTPUT-FORMAT PARAMETER IDENTIFIER
00140       INTEGER(I4P)::            F_OUT        = F_OUT_ASCII ! CURRENT OUTPUT-FORMAT (INITIALIZED TO ASCII FORMAT)
00141       CHARACTER(LEN=MAXLEN)::   TOPOLOGY                   ! MESH TOPOLOGY
00142       INTEGER(I4P)::            UNIT_VTK                   ! INTERNAL LOGICAL UNIT
00143       INTEGER(I4P)::            UNIT_VTK_APPEND            ! INTERNAL LOGICAL UNIT FOR RAW BINARY XML APPEND FILE
00144       INTEGER(I4P)::            N_BYTE                     ! NUMBER OF BYTE TO BE WRITTEN/READ
00145       REAL(R8P)::               TIPO_R8                    ! PROTOTYPE OF R8P REAL
00146       REAL(R4P)::               TIPO_R4                    ! PROTOTYPE OF R4P REAL
00147       INTEGER(I8P)::            TIPO_I8                    ! PROTOTYPE OF I8P INTEGER
00148       INTEGER(I4P)::            TIPO_I4                    ! PROTOTYPE OF I4P INTEGER
00149       INTEGER(I2P)::            TIPO_I2                    ! PROTOTYPE OF I2P INTEGER
00150       INTEGER(I1P)::            TIPO_I1                    ! PROTOTYPE OF I1P INTEGER
00151       INTEGER(I4P)::            IOFFSET                    ! OFFSET POINTER
00152       INTEGER(I4P)::            INDENT                     ! INDENT POINTER
00153       !----------------------------------------------------------------------------------------------------------------------------------
00154 
00155       !!IN THE FOLLOWING CHAPTERS THERE IS THE API REFERENCE OF ALL FUNCTIONS OF \LIBVTKIO.
00156       CONTAINS
00157         !!\chapter{Auxiliary functions}
00158         !!\minitoc
00159         !!\vspace*{8mm}
00160         !!
00161         !!\LIBVTKIO uses two auxiliary functions that are not connected with the VTK standard. These functions are private and so they
00162         !!cannot be called outside the library.
00163         FUNCTION GETUNIT() RESULT(FREE_UNIT)
00164         !--------------------------------------------------------------------------------------------------------------------------------
00165         !!The GetUnit function is used for getting a free logic unit. The users of \LIBVTKIO does not know which is
00166         !!the logical unit: \LIBVTKIO handels this information without boring the users. The logical unit used is safe-free: if the
00167         !!program calling \LIBVTKIO has others logical units used \LIBVTKIO will never use these units, but will choice one that is free.
00168         !--------------------------------------------------------------------------------------------------------------------------------
00169 
00170         IMPLICIT NONE
00171 
00172         !--------------------------------------------------------------------------------------------------------------------------------
00173         INTEGER(I4P):: FREE_UNIT ! FREE LOGIC UNIT
00174         INTEGER(I4P):: N1        ! COUNTER
00175         INTEGER(I4P):: IOS       ! INQUIRING FLAG
00176         LOGICAL(4)::   LOPEN     ! INQUIRING FLAG
00177         !--------------------------------------------------------------------------------------------------------------------------------
00178 
00179         !--------------------------------------------------------------------------------------------------------------------------------
00180         !!The following is the code snippet of GetUnit function: the units 0, 5, 6, 9 and all non-free units are discarded.
00181         !!
00182         !(\doc)codesnippet
00183         FREE_UNIT = -1_I4P                                      ! INITIALIZING FREE LOGIC UNIT
00184         N1=1_I4P                                                ! INITIALIZING COUNTER
00185         DO
00186           IF ((N1/=5_I4P).AND.(N1/=6_I4P).AND.(N1/=9_I4P)) THEN
00187             INQUIRE (UNIT=N1,OPENED=LOPEN,IOSTAT=IOS)           ! VERIFY LOGIC UNITS
00188             IF (IOS==0_I4P) THEN
00189               IF (.NOT.LOPEN) THEN
00190                 FREE_UNIT = N1                                  ! ASSIGNMENT OF FREE LOGIC
00191                 RETURN
00192               ENDIF
00193             ENDIF
00194           ENDIF
00195           N1=N1+1_I4P                                           ! UPDATING COUNTER
00196         ENDDO
00197         RETURN
00198         !(doc/)codesnippet
00199         !!GetUnit function is private and cannot be called outside \LIBVTKIO. If you are interested to use it change its scope to public.
00200         !--------------------------------------------------------------------------------------------------------------------------------
00201         END FUNCTION GETUNIT
00202 
00203         FUNCTION UPPER_CASE(STRING)
00204         !--------------------------------------------------------------------------------------------------------------------------------
00205         !!The Upper\_Case function converts the lower case characters of a string to upper case one. \LIBVTKIO uses this function in
00206         !!order to achieve case-insensitive: all character variables used within \LIBVTKIO functions are pre-processed by
00207         !!Uppper\_Case function before these variables are used. So the users can call \LIBVTKIO functions whitout pay attention of the
00208         !!case of the kwywords passed to the functions: calling the function VTK\_INI with the string \code{E_IO = VTK_INI('Ascii',...)}
00209         !!or with the string  \code{E_IO = VTK_INI('AscII',...)} is equivalent.
00210         !--------------------------------------------------------------------------------------------------------------------------------
00211 
00212         IMPLICIT NONE
00213 
00214         !--------------------------------------------------------------------------------------------------------------------------------
00215         CHARACTER(LEN=*), INTENT(IN):: STRING     ! STRING TO BE CONVERTED
00216         CHARACTER(LEN=LEN(STRING))::   UPPER_CASE ! CONVERTED STRING
00217         INTEGER::                      N1         ! CHARACTERS COUNTER
00218         !--------------------------------------------------------------------------------------------------------------------------------
00219 
00220         !--------------------------------------------------------------------------------------------------------------------------------
00221         !!The following is the code snippet of Upper\_Case function.
00222         !!
00223         !(\doc)codesnippet
00224         UPPER_CASE = STRING
00225         DO N1=1,LEN(STRING)
00226           SELECT CASE(ICHAR(STRING(N1:N1)))
00227           CASE(97:122)
00228             UPPER_CASE(N1:N1)=CHAR(ICHAR(STRING(N1:N1))-32) ! UPPER CASE CONVERSION
00229           ENDSELECT
00230         ENDDO
00231         RETURN
00232         !(doc/)codesnippet
00233         !!Upper\_Case function is private and cannot be called outside \LIBVTKIO. If you are interested to use it change its scope
00234         !!to public.
00235         !--------------------------------------------------------------------------------------------------------------------------------
00236         END FUNCTION UPPER_CASE
00237 
00238         !!\chapter{VTK LEGACY functions}
00239         !!\minitoc
00240         !!\vspace*{8mm}
00241         !!
00242         FUNCTION VTK_INI(OUTPUT_FORMAT,FILENAME,TITLE,MESH_TOPOLOGY)
00243      &          RESULT(E_IO)
00244         !--------------------------------------------------------------------------------------------------------------------------------
00245         !!The VTK\_INI function is used for initializing file. This function must be the first to be called.
00246         !--------------------------------------------------------------------------------------------------------------------------------
00247 
00248         IMPLICIT NONE
00249 
00250         !--------------------------------------------------------------------------------------------------------------------------------
00251         CHARACTER(*), INTENT(IN):: OUTPUT_FORMAT ! OUTPUT FORMAT: ASCII OR BINARY
00252         CHARACTER(*), INTENT(IN):: FILENAME      ! NAME OF FILE
00253         CHARACTER(*), INTENT(IN):: TITLE         ! TITLE
00254         CHARACTER(*), INTENT(IN):: MESH_TOPOLOGY ! MESH TOPOLOGY
00255         INTEGER(I4P)::             E_IO          ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00256         !!The VTK\_INI variables have the following meaning:
00257         !!
00258         !!\begin{description}
00259         !! \item[{\color{RoyalBlue}output\_format}] indicates the \virgo{format} of output file. It can assume the following values:
00260         !! \begin{enumerateABlu}
00261         !!  \item \emph{ascii} (it is case insensitive) $\rightarrow$ creating an ascii output file.
00262         !!  \item \emph{binary} (it is case insensitive) $\rightarrow$ creating a binary (big\_endian encoding) output file.
00263         !! \end{enumerateABlu}
00264         !! \item[{\color{RoyalBlue}filename}] contains the name (with its path) of the output file.
00265         !! \item[{\color{RoyalBlue}title}] contains the title of the VTK dataset.
00266         !! \item[{\color{RoyalBlue}topology}] indicates the topology of the mesh and can assume the following values:
00267         !! \begin{enumerateABlu}
00268         !!  \item \emph{STRUCTURED\_POINTS}.
00269         !!  \item \emph{STRUCTURED\_GRID}.
00270         !!  \item \emph{UNSTRUCTURED\_GRID}.
00271         !!  \item \emph{RECTILINEAR\_GRID}.
00272         !! \end{enumerateABlu}
00273         !! \item[{\color{RoyalBlue}E\_IO}] contains the inquiring integer flag for error handling.
00274         !!\end{description}
00275         !!
00276         !!The following is an example of VTK\_INI calling:
00277         !!
00278         !!\begin{boxred}{VTK\_INI Calling}
00279         !!\begin{verbatim}
00280         !!...
00281         !!E_IO = VTK_INI('Binary','example.vtk','VTK legacy file','UNSTRUCTURED_GRID')
00282         !!...
00283         !!\end{verbatim}
00284         !!\end{boxred}
00285         !!\noindent Note that the \virgo{.vtk} extension is necessary in the file name.
00286         !--------------------------------------------------------------------------------------------------------------------------------
00287 
00288         !--------------------------------------------------------------------------------------------------------------------------------
00289         TOPOLOGY = TRIM(MESH_TOPOLOGY)
00290         UNIT_VTK=GETUNIT()
00291         SELECT CASE(TRIM(UPPER_CASE(OUTPUT_FORMAT)))
00292         CASE('ASCII')
00293           F_OUT = F_OUT_ASCII
00294           OPEN(UNIT     = UNIT_VTK,
00295      &         FILE     = TRIM(FILENAME),
00296      &         FORM     = 'FORMATTED',
00297      &         ACCESS   = 'SEQUENTIAL',
00298      &         ACTION   = 'WRITE',
00299 !     &         BUFFERED = 'YES',
00300      &         IOSTAT   = E_IO)
00301           ! WRITING HEADER OF FILE
00302           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)
00303      &                  '# vtk DataFile Version 3.0'
00304           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)TRIM(TITLE)
00305           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)
00306      &                  TRIM(UPPER_CASE(OUTPUT_FORMAT))
00307           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)
00308      &                  'DATASET '//TRIM(TOPOLOGY)
00309         CASE('BINARY')
00310           F_OUT = F_OUT_BINARY
00311           OPEN(UNIT       = UNIT_VTK,
00312      &         FILE       = TRIM(FILENAME),
00313      &         FORM       = 'UNFORMATTED',
00314      &         ACCESS     = 'SEQUENTIAL',
00315      &         ACTION     = 'WRITE',
00316 !     &         RECORDTYPE = 'STREAM',
00317 !     &         BUFFERED   = 'YES',
00318      &         IOSTAT     = E_IO)
00319           ! WRITING HEADER OF FILE
00320           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'# vtk DataFile Version 3.0'//
00321      &                                    END_REC
00322           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)TRIM(TITLE)//END_REC
00323           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)
00324      &               TRIM(UPPER_CASE(OUTPUT_FORMAT))//END_REC
00325           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'DATASET '//TRIM(TOPOLOGY)//
00326      &               END_REC
00327         ENDSELECT
00328         RETURN
00329         !--------------------------------------------------------------------------------------------------------------------------------
00330         END FUNCTION VTK_INI
00331 
00332         !!\section{VTK\_GEO}
00333         !!
00334         !!VTK\_GEO is an interface to 8 different functions; there are 2 functions for each 4 different topologies actually supported:
00335         !!one function for mesh coordinates with R8P precision and one for mesh coordinates with R4P precision.
00336         !!This function must be called after VTK\_INI. It saves the mesh geometry. The inputs that must be passed change depending on
00337         !!the topologies choiced. Not all VTK topologies have been implemented (\virgo{polydata} topologies are absent). The signatures
00338         !!for all implemented topologies are now reported.
00339         !!
00340         !!\subsection{VTK\_GEO STRUCTURED POINTS}
00341         !!
00342         !!\begin{boxred}{}
00343         !!\begin{lstlisting}[style=signature,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Structured Points Signature}]
00344         !! function VTK_GEO(NX,NY,NZ,X0,Y0,Z0,Dx,Dy,Dz) result(E_IO)
00345         !!\end{lstlisting}
00346         !!\end{boxred}
00347         !!
00348         !!The topology \virgo{structured points} is useful for structured grid with uniform discretization steps.
00349         !!
00350         !!\begin{boxred}{}
00351         !!\begin{lstlisting}[style=variables,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Structured Points Variables}]
00352         !!integer(I4P),     intent(IN):: NX   ! number of nodes in x direction
00353         !!integer(I4P),     intent(IN):: NY   ! number of nodes in y direction
00354         !!integer(I4P),     intent(IN):: NZ   ! number of nodes in z direction
00355         !!real(R8P or R4P), intent(IN):: X0   ! x coordinate of origin
00356         !!real(R8P or R4P), intent(IN):: Y0   ! y coordinate of origin
00357         !!real(R8P or R4P), intent(IN):: Z0   ! z coordinate of origin
00358         !!real(R8P or R4P), intent(IN):: Dx   ! space step in x
00359         !!real(R8P or R4P), intent(IN):: Dy   ! space step in y
00360         !!real(R8P or R4P), intent(IN):: Dz   ! space step in z
00361         !!integer(I4P)::                 E_IO ! Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
00362         !!\end{lstlisting}
00363         !!\end{boxred}
00364         !!
00365         !!Note that the variables \texttt{X0,Y0,Z0,Dx,Dy,Dz} can be passed both as 8-byte real kind and 4-byte real kind; the dynamic
00366         !!displacement interface will call the correct function. Mixing 8-byte real kind and 4-byte real kind is not allowed: be sure
00367         !!that all variables are 8-byte real kind or all are 4-byte real kind.
00368         !!
00369         !!The VTK\_GEO structured point variables have the following meaning:
00370         !!
00371         !!\begin{description}
00372         !! \item[{\color{RoyalBlue}NX}] indicates the number of nodes in $X$ direction.
00373         !! \item[{\color{RoyalBlue}NY}] indicates the number of nodes in $Y$ direction.
00374         !! \item[{\color{RoyalBlue}NZ}] indicates the number of nodes in $Z$ direction.
00375         !! \item[{\color{RoyalBlue}X0}] indicates the $X$ value of coordinates system origin. It is a scalar.
00376         !! \item[{\color{RoyalBlue}Y0}] indicates the $Y$ value of coordinates system origin. It is a scalar.
00377         !! \item[{\color{RoyalBlue}Z0}] indicates the $Z$ value of coordinates system origin. It is a scalar.
00378         !! \item[{\color{RoyalBlue}Dx}] indicates the uniform grid step discretization in $X$ direction. It is a scalar.
00379         !! \item[{\color{RoyalBlue}Dy}] indicates the uniform grid step discretization in $Y$ direction. It is a scalar.
00380         !! \item[{\color{RoyalBlue}DZ}] indicates the uniform grid step discretization in $Z$ direction. It is a scalar.
00381         !! \item[{\color{RoyalBlue}E\_IO}] contains the inquiring integer flag for error handling.
00382         !!\end{description}
00383         !!
00384         !!The following is an example of VTK\_GEO structured point calling:
00385         !!
00386         !!\begin{boxred}{VTK\_GEO Structured Points Calling}
00387         !!\begin{verbatim}
00388         !!...
00389         !!integer(4):: NX,NY,NZ
00390         !!real(8):: X0,Y0,Z0
00391         !!real(8):: Dx,Dy,Dz
00392         !!...
00393         !!E_IO = VTK_GEO(NX,NY,NZ, &
00394         !!               X0,Y0,Z0,Dx,Dy,Dz)
00395         !!...
00396         !!\end{verbatim}
00397         !!\end{boxred}
00398         !!
00399         !!\subsection{VTK\_GEO STRUCTURED GRID}
00400         !!
00401         !!\begin{boxred}{}
00402         !!\begin{lstlisting}[style=signature,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Structured Grid Signature}]
00403         !!function VTK_GEO(NX,NY,NZ,NN,X,Y,Z) result(E_IO)
00404         !!\end{lstlisting}
00405         !!\end{boxred}
00406         !!
00407         !!The topology \virgo{structured grid} is useful for structured grid with non-uniform discretization steps.
00408         !!
00409         !!\begin{boxred}{}
00410         !!\begin{lstlisting}[style=variables,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Structured Grid Variables}]
00411         !!integer(I4P),     intent(IN):: NX      ! number of nodes in x direction
00412         !!integer(I4P),     intent(IN):: NY      ! number of nodes in y direction
00413         !!integer(I4P),     intent(IN):: NZ      ! number of nodes in z direction
00414         !!integer(I4P),     intent(IN):: NN      ! number of all nodes
00415         !!real(R8P or R4P), intent(IN):: X(1:NN) ! x coordinates
00416         !!real(R8P or R4P), intent(IN):: Y(1:NN) ! y coordinates
00417         !!real(R8P or R4P), intent(IN):: Z(1:NN) ! z coordinates
00418         !!integer(I4P)::                 E_IO    ! Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
00419         !!\end{lstlisting}
00420         !!\end{boxred}
00421         !!
00422         !!Note that the variables \texttt{X,Y,Z} can be passed both as 8-byte real kind and 4-byte real kind; the dynamic
00423         !!displacement interface will call the correct function. Mixing 8-byte real kind and 4-byte real kind is not allowed: be
00424         !!sure that all variables are 8-byte real kind or all are 4-byte real kind.
00425         !!
00426         !!The VTK\_GEO structured grid variables have the following meaning:
00427         !!
00428         !!\begin{description}
00429         !!  \item[{\color{RoyalBlue}NX}] indicates the number of nodes in $X$ direction.
00430         !!  \item[{\color{RoyalBlue}NY}] indicates the number of nodes in $Y$ direction.
00431         !!  \item[{\color{RoyalBlue}NZ}] indicates the number of nodes in $Z$ direction.
00432         !!  \item[{\color{RoyalBlue}NN}] indicates the number of all nodes, $NN= NX\cdot NY\cdot NZ$.
00433         !!  \item[{\color{RoyalBlue}X}] contains the $X$ coordinates values of all nodes. It is a vector of $[1:NN]$.
00434         !!  \item[{\color{RoyalBlue}Y}] contains the $Y$ coordinates values of all nodes. It is a vector of $[1:NN]$.
00435         !!  \item[{\color{RoyalBlue}Z}] contains the $Z$ coordinates values of all nodes. It is a vector of $[1:NN]$.
00436         !!  \item[{\color{RoyalBlue}E\_IO}] contains the inquiring integer flag for error handling.
00437         !!\end{description}
00438         !!
00439         !!The following is an example of VTK\_GEO structured grid calling:
00440         !!
00441         !!\begin{boxred}{VTK\_GEO Structured Grid Calling}
00442         !!\begin{verbatim}
00443         !!...
00444         !!integer(4), parameter:: NX=10,NY=10,NZ=10
00445         !!integer(4), parameter:: Nnodi=NX*NY*NZ
00446         !!real(8):: X(1:Nnodi),Y(1:Nnodi),Z(1:Nnodi)
00447         !!...
00448         !!E_IO = VTK_GEO(NX,NY,NZ,Nnodi,X,Y,Z)
00449         !!...
00450         !!\end{verbatim}
00451         !!\end{boxred}
00452         !!
00453         !!\subsection{VTK\_GEO RECTILINEAR GRID}
00454         !!
00455         !!\begin{boxred}{}
00456         !!\begin{lstlisting}[style=signature,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Rectilinear Grid Signature}]
00457         !!function VTK_GEO(NX,NY,NZ,X,Y,Z) result(E_IO)
00458         !!\end{lstlisting}
00459         !!\end{boxred}
00460         !!
00461         !!The topology \virgo{rectilinear grid} is useful for structured grid with non-uniform discretization steps even
00462         !!in generalized coordinates.
00463         !!
00464         !!\begin{boxred}{}
00465         !!\begin{lstlisting}[style=variables,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Rectilinear Grid Signature}]
00466         !!integer(I4P),     intent(IN):: NX      ! number of nodes in x direction
00467         !!integer(I4P),     intent(IN):: NY      ! number of nodes in y direction
00468         !!integer(I4P),     intent(IN):: NZ      ! number of nodes in z direction
00469         !!real(R8P or R4P), intent(IN):: X(1:NX) ! x coordinates
00470         !!real(R8P or R4P), intent(IN):: Y(1:NY) ! y coordinates
00471         !!real(R8P or R4P), intent(IN):: Z(1:NZ) ! z coordinates
00472         !!integer(I4P)::                 E_IO    ! Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
00473         !!\end{lstlisting}
00474         !!\end{boxred}
00475         !!
00476         !!Note that the variables \texttt{X,Y,Z} can be passed both as 8-byte real kind and 4-byte real kind; the dynamic
00477         !!displacement interface will call the correct function. Mixing 8-byte real kind and 4-byte real kind is not allowed: be
00478         !!sure that all variables are 8-byte real kind or all are 4-byte real kind.
00479         !!
00480         !!The VTK\_GEO rectilinear grid variables have the following meaning:
00481         !!
00482         !!\begin{description}
00483         !! \item[{\color{RoyalBlue}NX}] indicates the number of nodes in $X$ direction.
00484         !! \item[{\color{RoyalBlue}NY}] indicates the number of nodes in $Y$ direction.
00485         !! \item[{\color{RoyalBlue}NZ}] indicates the number of nodes in $Z$ direction.
00486         !! \item[{\color{RoyalBlue}X}] contains the $X$ coordinates values of nodes. It is a vector of $[1:NX]$.
00487         !! \item[{\color{RoyalBlue}Y}] contains the $Y$ coordinates values of nodes. It is a vector of $[1:NY]$.
00488         !! \item[{\color{RoyalBlue}Z}] contains the $Z$ coordinates values of nodes. It is a vector of $[1:NZ]$.
00489         !! \item[{\color{RoyalBlue}E\_IO}] contains the inquiring integer flag for error handling.
00490         !!\end{description}
00491         !!
00492         !!The following is an example of VTK\_GEO rectilinear grid calling:
00493         !!
00494         !!\begin{boxred}{VTK\_GEO Rectilinear Grid Calling}
00495         !!\begin{verbatim}
00496         !!...
00497         !!integer(4), parameter:: NX=10,NY=20,NZ=30
00498         !!real(4):: X(1:NX),Y(1:NY),Z(1:NZ)
00499         !!...
00500         !!E_IO = VTK_GEO(NX,NY,NZ,X,Y,Z)
00501         !!...
00502         !!\end{verbatim}
00503         !!\end{boxred}
00504         !!
00505         !!\subsection{VTK\_GEO UNSTRUCTURED GRID}
00506         !!
00507         !!\begin{boxred}{}
00508         !!\begin{lstlisting}[style=signature,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Unstructured Grid Signature}]
00509         !!function VTK_GEO(Nnodi,X,Y,Z) result(E_IO)
00510         !!\end{lstlisting}
00511         !!\end{boxred}
00512         !!
00513         !!The topology \virgo{unstructured grid} is necessary for unstructured grid, the most general mesh format. This
00514         !!topology is also useful for scructured mesh in order to save only a non-structured clip of mesh.
00515         !!
00516         !!\begin{boxred}{}
00517         !!\begin{lstlisting}[style=variables,title=\color{Maroon}\MaiuscolettoBS{VTK\_GEO Unstructured Grid Variables}]
00518         !!integer(I4P),     intent(IN):: NN      ! number of nodes
00519         !!real(R8P or R4P), intent(IN):: X(1:NN) ! x coordinates of all nodes
00520         !!real(R8P or R4P), intent(IN):: Y(1:NN) ! y coordinates of all nodes
00521         !!real(R8P or R4P), intent(IN):: Z(1:NN) ! z coordinates of all nodes
00522         !!integer(I4P)::                 E_IO    ! Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
00523         !!\end{lstlisting}
00524         !!\end{boxred}
00525         !!
00526         !!Note that the variables \texttt{X,Y,Z} can be passed both as 8-byte real kind and 4-byte real kind; the dynamic
00527         !!displacement interface will call the correct function. Mixing 8-byte real kind and 4-byte real kind is not allowed: be
00528         !!sure that all variables are 8-byte real kind or all are 4-byte real kind.
00529         !!
00530         !!The VTK\_GEO unstructured grid variables have the following meaning:
00531         !!
00532         !!\begin{description}
00533         !! \item[{\color{RoyalBlue}NN}] indicates the number of all nodes.
00534         !! \item[{\color{RoyalBlue}X}] contains the $X$ coordinates values of nodes. It is a vector of $[1:NN]$.
00535         !! \item[{\color{RoyalBlue}Y}] contains the $Y$ coordinates values of nodes. It is a vector of $[1:NN]$.
00536         !! \item[{\color{RoyalBlue}Z}] contains the $Z$ coordinates values of nodes. It is a vector of $[1:NN]$.
00537         !! \item[{\color{RoyalBlue}E\_IO}] contains the inquiring integer flag for error handling.
00538         !!\end{description}
00539         !!
00540         !!The following is an example of VTK\_GEO unstructured grid calling:
00541         !!
00542         !!\begin{boxred}{VTK\_GEO Unstructured Grid Calling}
00543         !!\begin{verbatim}
00544         !!...
00545         !!integer(4), parameter:: NN=100
00546         !!real(4):: X(1:NN),Y(1:NN),Z(1:NN)
00547         !!...
00548         !!E_IO = VTK_GEO(NN,X,Y,Z)
00549         !!...
00550         !!\end{verbatim}
00551         !!\end{boxred}
00552         !!
00553         !!In order to use the \virgo{unstructured grid} it is necessary to save also the \virgo{connectivity} of the grid. The
00554         !!connectivity must be saved with the function \MaiuscolettoBS{VTK\_CON}.
00555         !!
00556         !(\doc)skippedblock
00557         FUNCTION VTK_GEO_STRP_R8(NX,NY,NZ,X0,Y0,Z0,DX,DY,DZ)
00558      &  RESULT(E_IO)
00559         !--------------------------------------------------------------------------------------------------------------------------------
00560         !! FUNCTION FOR SAVING MESH; TOPOLOGY = STRUCTURED\_POINTS (R8P).
00561         !--------------------------------------------------------------------------------------------------------------------------------
00562 
00563         IMPLICIT NONE
00564 
00565         !--------------------------------------------------------------------------------------------------------------------------------
00566         INTEGER(I4P), INTENT(IN):: NX        ! NUMBER OF NODES IN X DIRECTION
00567         INTEGER(I4P), INTENT(IN):: NY        ! NUMBER OF NODES IN Y DIRECTION
00568         INTEGER(I4P), INTENT(IN):: NZ        ! NUMBER OF NODES IN Z DIRECTION
00569         REAL(R8P),    INTENT(IN):: X0        ! X COORDINATE OF ORIGIN
00570         REAL(R8P),    INTENT(IN):: Y0        ! Y COORDINATE OF ORIGIN
00571         REAL(R8P),    INTENT(IN):: Z0        ! Z COORDINATE OF ORIGIN
00572         REAL(R8P),    INTENT(IN):: DX        ! SPACE STEP IN X DIRECTION
00573         REAL(R8P),    INTENT(IN):: DY        ! SPACE STEP IN Y DIRECTION
00574         REAL(R8P),    INTENT(IN):: DZ        ! SPACE STEP IN Z DIRECTION
00575         INTEGER(I4P)::             E_IO      ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00576         CHARACTER(LEN=MAXLEN)::    S_BUFFER  ! BUFFER STRING
00577         !--------------------------------------------------------------------------------------------------------------------------------
00578 
00579         !--------------------------------------------------------------------------------------------------------------------------------
00580         SELECT CASE(F_OUT)
00581         CASE(F_OUT_ASCII)
00582           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00583      &          'DIMENSIONS ',NX,NY,NZ
00584           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FR8P//')', IOSTAT=E_IO)
00585      &          'ORIGIN ',X0,Y0,Z0
00586           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FR8P//')', IOSTAT=E_IO)
00587      &          'SPACING ',DX,DY,DZ
00588         CASE(F_OUT_BINARY)
00589           WRITE(S_BUFFER,     FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00590      &          'DIMENSIONS ',NX,NY,NZ
00591           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00592      &           TRIM(S_BUFFER)//END_REC
00593           WRITE(S_BUFFER,     FMT='(A,3'//FR8P//')', IOSTAT=E_IO)
00594      &           'ORIGIN ',X0,Y0,Z0
00595           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00596      &           TRIM(S_BUFFER)//END_REC
00597           WRITE(S_BUFFER,     FMT='(A,3'//FR8P//')', IOSTAT=E_IO)
00598      &           'SPACING ',DX,DY,DZ
00599           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00600      &           TRIM(S_BUFFER)//END_REC
00601         ENDSELECT
00602         RETURN
00603         !--------------------------------------------------------------------------------------------------------------------------------
00604         END FUNCTION VTK_GEO_STRP_R8
00605 
00606         FUNCTION VTK_GEO_STRP_R4(NX,NY,NZ,X0,Y0,Z0,DX,DY,DZ)
00607      &  RESULT(E_IO)
00608         !--------------------------------------------------------------------------------------------------------------------------------
00609         !! FUNCTION FOR SAVING MESH; TOPOLOGY = STRUCTURED\_POINTS (R4P).
00610         !--------------------------------------------------------------------------------------------------------------------------------
00611 
00612         IMPLICIT NONE
00613 
00614         !--------------------------------------------------------------------------------------------------------------------------------
00615         INTEGER(I4P), INTENT(IN):: NX        ! NUMBER OF NODES IN X DIRECTION
00616         INTEGER(I4P), INTENT(IN):: NY        ! NUMBER OF NODES IN Y DIRECTION
00617         INTEGER(I4P), INTENT(IN):: NZ        ! NUMBER OF NODES IN Z DIRECTION
00618         REAL(R4P),    INTENT(IN):: X0        ! X COORDINATE OF ORIGIN
00619         REAL(R4P),    INTENT(IN):: Y0        ! Y COORDINATE OF ORIGIN
00620         REAL(R4P),    INTENT(IN):: Z0        ! Z COORDINATE OF ORIGIN
00621         REAL(R4P),    INTENT(IN):: DX        ! SPACE STEP IN X DIRECTION
00622         REAL(R4P),    INTENT(IN):: DY        ! SPACE STEP IN Y DIRECTION
00623         REAL(R4P),    INTENT(IN):: DZ        ! SPACE STEP IN Z DIRECTION
00624         INTEGER(I4P)::             E_IO      ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00625         CHARACTER(LEN=MAXLEN)::    S_BUFFER  ! BUFFER STRING
00626         !--------------------------------------------------------------------------------------------------------------------------------
00627 
00628         !--------------------------------------------------------------------------------------------------------------------------------
00629         SELECT CASE(F_OUT)
00630         CASE(F_OUT_ASCII)
00631           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00632      &          'DIMENSIONS ',NX,NY,NZ
00633           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FR4P//')', IOSTAT=E_IO)
00634      &          'ORIGIN ',X0,Y0,Z0
00635           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FR4P//')', IOSTAT=E_IO)
00636      &          'SPACING ',DX,DY,DZ
00637         CASE(F_OUT_BINARY)
00638           WRITE(S_BUFFER,     FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00639      &          'DIMENSIONS ',NX,NY,NZ
00640           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00641      &          TRIM(S_BUFFER)//END_REC
00642           WRITE(S_BUFFER,     FMT='(A,3'//FR4P//')', IOSTAT=E_IO)
00643      &          'ORIGIN ',X0,Y0,Z0
00644           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00645      &          TRIM(S_BUFFER)//END_REC
00646           WRITE(S_BUFFER,     FMT='(A,3'//FR4P//')', IOSTAT=E_IO)
00647      &          'SPACING ',DX,DY,DZ
00648           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00649      &          TRIM(S_BUFFER)//END_REC
00650         ENDSELECT
00651         RETURN
00652         !--------------------------------------------------------------------------------------------------------------------------------
00653         END FUNCTION VTK_GEO_STRP_R4
00654 
00655         FUNCTION VTK_GEO_STRG_R8(NX,NY,NZ,NN,X,Y,Z) RESULT(E_IO)
00656         !--------------------------------------------------------------------------------------------------------------------------------
00657         !! FUNCTION FOR SAVING MESH; TOPOLOGY = STRUCTURED\_GRID (R8P).
00658         !--------------------------------------------------------------------------------------------------------------------------------
00659 
00660         IMPLICIT NONE
00661 
00662         !--------------------------------------------------------------------------------------------------------------------------------
00663         INTEGER(I4P), INTENT(IN):: NX       ! NUMBER OF NODES IN X DIRECTION
00664         INTEGER(I4P), INTENT(IN):: NY       ! NUMBER OF NODES IN Y DIRECTION
00665         INTEGER(I4P), INTENT(IN):: NZ       ! NUMBER OF NODES IN Z DIRECTION
00666         INTEGER(I4P), INTENT(IN):: NN       ! NUMBER OF ALL NODES
00667         REAL(R8P),    INTENT(IN):: X(1:NN)  ! X COORDINATES
00668         REAL(R8P),    INTENT(IN):: Y(1:NN)  ! Y COORDINATES
00669         REAL(R8P),    INTENT(IN):: Z(1:NN)  ! Z COORDINATES
00670         INTEGER(I4P)::             E_IO     ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00671         CHARACTER(LEN=MAXLEN)::    S_BUFFER ! BUFFER STRING
00672         INTEGER(I4P)::             N1       ! COUNTER
00673         !--------------------------------------------------------------------------------------------------------------------------------
00674 
00675         !--------------------------------------------------------------------------------------------------------------------------------
00676         SELECT CASE(F_OUT)
00677         CASE(F_OUT_ASCII)
00678           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00679      &          'DIMENSIONS ',NX,NY,NZ
00680           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00681      &          'POINTS ',NN,' double'
00682           WRITE(UNIT=UNIT_VTK,FMT='(3'//FR8P//')',   IOSTAT=E_IO)
00683      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00684         CASE(F_OUT_BINARY)
00685           WRITE(S_BUFFER,     FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00686      &          'DIMENSIONS ',NX,NY,NZ
00687           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00688      &          TRIM(S_BUFFER)//END_REC
00689           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00690      &          'POINTS ',NN,' double'
00691           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00692      &          TRIM(S_BUFFER)//END_REC
00693           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00694      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00695           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00696         ENDSELECT
00697         RETURN
00698         !--------------------------------------------------------------------------------------------------------------------------------
00699         END FUNCTION VTK_GEO_STRG_R8
00700 
00701         FUNCTION VTK_GEO_STRG_R4(NX,NY,NZ,NN,X,Y,Z) RESULT(E_IO)
00702         !--------------------------------------------------------------------------------------------------------------------------------
00703         !! FUNCTION FOR SAVING MESH; TOPOLOGY = STRUCTURED\_GRID (R4P).
00704         !--------------------------------------------------------------------------------------------------------------------------------
00705 
00706         IMPLICIT NONE
00707 
00708         !--------------------------------------------------------------------------------------------------------------------------------
00709         INTEGER(I4P), INTENT(IN):: NX       ! NUMBER OF NODES IN X DIRECTION
00710         INTEGER(I4P), INTENT(IN):: NY       ! NUMBER OF NODES IN Y DIRECTION
00711         INTEGER(I4P), INTENT(IN):: NZ       ! NUMBER OF NODES IN Z DIRECTION
00712         INTEGER(I4P), INTENT(IN):: NN       ! NUMBER OF ALL NODES
00713         REAL(R4P),    INTENT(IN):: X(1:NN)  ! X COORDINATES
00714         REAL(R4P),    INTENT(IN):: Y(1:NN)  ! Y COORDINATES
00715         REAL(R4P),    INTENT(IN):: Z(1:NN)  ! Z COORDINATES
00716         INTEGER(I4P)::             E_IO     ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00717         CHARACTER(LEN=MAXLEN)::    S_BUFFER ! BUFFER STRING
00718         INTEGER(I4P)::             N1       ! COUNTER
00719         !--------------------------------------------------------------------------------------------------------------------------------
00720 
00721         !--------------------------------------------------------------------------------------------------------------------------------
00722         SELECT CASE(F_OUT)
00723         CASE(F_OUT_ASCII)
00724           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00725      &          'DIMENSIONS ',NX,NY,NZ
00726           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00727      &          'POINTS ',NN,' float'
00728           WRITE(UNIT=UNIT_VTK,FMT='(3'//FR4P//')',   IOSTAT=E_IO)
00729      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00730         CASE(F_OUT_BINARY)
00731           WRITE(S_BUFFER,     FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00732      &          'DIMENSIONS ',NX,NY,NZ
00733           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00734      &          TRIM(S_BUFFER)//END_REC
00735           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00736      &          'POINTS ',NN,' float'
00737           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00738      &          TRIM(S_BUFFER)//END_REC
00739           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00740      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00741           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00742         ENDSELECT
00743         RETURN
00744         !--------------------------------------------------------------------------------------------------------------------------------
00745         END FUNCTION VTK_GEO_STRG_R4
00746 
00747         FUNCTION VTK_GEO_RECT_R8(NX,NY,NZ,X,Y,Z) RESULT(E_IO)
00748         !--------------------------------------------------------------------------------------------------------------------------------
00749         !! FUNCTION FOR SAVING MESH; TOPOLOGY = RECTILINEAR\_GRID (R8P).
00750         !--------------------------------------------------------------------------------------------------------------------------------
00751 
00752         IMPLICIT NONE
00753 
00754         !--------------------------------------------------------------------------------------------------------------------------------
00755         INTEGER(I4P), INTENT(IN):: NX        ! NUMBER OF NODES IN X DIRECTION
00756         INTEGER(I4P), INTENT(IN):: NY        ! NUMBER OF NODES IN Y DIRECTION
00757         INTEGER(I4P), INTENT(IN):: NZ        ! NUMBER OF NODES IN Z DIRECTION
00758         REAL(R8P),    INTENT(IN):: X(1:NX)   ! X COORDINATES
00759         REAL(R8P),    INTENT(IN):: Y(1:NY)   ! Y COORDINATES
00760         REAL(R8P),    INTENT(IN):: Z(1:NZ)   ! Z COORDINATES
00761         INTEGER(I4P)::             E_IO      ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00762         CHARACTER(LEN=MAXLEN)::    S_BUFFER  ! BUFFER STRING
00763         INTEGER(I4P)::             N1        ! COUNTER
00764         !--------------------------------------------------------------------------------------------------------------------------------
00765 
00766         !--------------------------------------------------------------------------------------------------------------------------------
00767         SELECT CASE(F_OUT)
00768         CASE(F_OUT_ASCII)
00769           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00770      &          'DIMENSIONS ',NX,NY,NZ
00771           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00772      &          'X_COORDINATES ',NX,' double'
00773           WRITE(UNIT=UNIT_VTK,FMT=FR8P,              IOSTAT=E_IO)
00774      &          (X(N1),N1=1,NX)
00775           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00776      &          'Y_COORDINATES ',NY,' double'
00777           WRITE(UNIT=UNIT_VTK,FMT=FR8P,              IOSTAT=E_IO)
00778      &          (Y(N1),N1=1,NY)
00779           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00780      &          'Z_COORDINATES ',NZ,' double'
00781           WRITE(UNIT=UNIT_VTK,FMT=FR8P,              IOSTAT=E_IO)
00782      &          (Z(N1),N1=1,NZ)
00783         CASE(F_OUT_BINARY)
00784           WRITE(S_BUFFER,     FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00785      &          'DIMENSIONS ',NX,NY,NZ
00786           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00787      &          TRIM(S_BUFFER)//END_REC
00788           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00789      &          'X_COORDINATES ',NX,' double'
00790           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00791      &          TRIM(S_BUFFER)//END_REC
00792           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00793      &          (X(N1),N1=1,NX)
00794           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00795           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00796      &          'Y_COORDINATES ',NY,' double'
00797           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00798      &          TRIM(S_BUFFER)//END_REC
00799           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00800      &          (Y(N1),N1=1,NY)
00801           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00802           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00803      &          'Z_COORDINATES ',NZ,' double'
00804           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00805      &          TRIM(S_BUFFER)//END_REC
00806           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00807      &          (Z(N1),N1=1,NZ)
00808           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00809         ENDSELECT
00810         RETURN
00811         !--------------------------------------------------------------------------------------------------------------------------------
00812         END FUNCTION VTK_GEO_RECT_R8
00813 
00814         FUNCTION VTK_GEO_RECT_R4(NX,NY,NZ,X,Y,Z) RESULT(E_IO)
00815         !--------------------------------------------------------------------------------------------------------------------------------
00816         !! FUNCTION FOR SAVING MESH; TOPOLOGY = RECTILINEAR\_GRID (R4P).
00817         !--------------------------------------------------------------------------------------------------------------------------------
00818 
00819         IMPLICIT NONE
00820 
00821         !--------------------------------------------------------------------------------------------------------------------------------
00822         INTEGER(I4P), INTENT(IN):: NX        ! NUMBER OF NODES IN X DIRECTION
00823         INTEGER(I4P), INTENT(IN):: NY        ! NUMBER OF NODES IN Y DIRECTION
00824         INTEGER(I4P), INTENT(IN):: NZ        ! NUMBER OF NODES IN Z DIRECTION
00825         REAL(R4P),    INTENT(IN):: X(1:NX)   ! X COORDINATES
00826         REAL(R4P),    INTENT(IN):: Y(1:NY)   ! Y COORDINATES
00827         REAL(R4P),    INTENT(IN):: Z(1:NZ)   ! Z COORDINATES
00828         INTEGER(I4P)::             E_IO      ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00829         CHARACTER(LEN=MAXLEN)::    S_BUFFER  ! BUFFER STRING
00830         INTEGER(I4P)::             N1        ! COUNTER
00831         !--------------------------------------------------------------------------------------------------------------------------------
00832 
00833         !--------------------------------------------------------------------------------------------------------------------------------
00834         SELECT CASE(F_OUT)
00835         CASE(F_OUT_ASCII)
00836           WRITE(UNIT=UNIT_VTK,FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00837      &          'DIMENSIONS ',NX,NY,NZ
00838           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00839      &          'X_COORDINATES ',NX,' float'
00840           WRITE(UNIT=UNIT_VTK,FMT=FR4P,              IOSTAT=E_IO)
00841      &          (X(N1),N1=1,NX)
00842           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00843      &          'Y_COORDINATES ',NY,' float'
00844           WRITE(UNIT=UNIT_VTK,FMT=FR4P,              IOSTAT=E_IO)
00845      &          (Y(N1),N1=1,NY)
00846           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00847      &          'Z_COORDINATES ',NZ,' float'
00848           WRITE(UNIT=UNIT_VTK,FMT=FR4P,              IOSTAT=E_IO)
00849      &          (Z(N1),N1=1,NZ)
00850         CASE(F_OUT_BINARY)
00851           WRITE(S_BUFFER,     FMT='(A,3'//FI4P//')', IOSTAT=E_IO)
00852      &          'DIMENSIONS ',NX,NY,NZ
00853           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00854      &          TRIM(S_BUFFER)//END_REC
00855           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00856      &          'X_COORDINATES ',NX,' float'
00857           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00858      &          TRIM(S_BUFFER)//END_REC
00859           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00860      &          (X(N1),N1=1,NX)
00861           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00862           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00863      &          'Y_COORDINATES ',NY,' float'
00864           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00865      &          TRIM(S_BUFFER)//END_REC
00866           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00867      &          (Y(N1),N1=1,NY)
00868           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00869           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00870      &          'Z_COORDINATES ',NZ,' float'
00871           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00872      &          TRIM(S_BUFFER)//END_REC
00873           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00874      &          (Z(N1),N1=1,NZ)
00875           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00876         ENDSELECT
00877         RETURN
00878         !--------------------------------------------------------------------------------------------------------------------------------
00879         END FUNCTION VTK_GEO_RECT_R4
00880 
00881         FUNCTION VTK_GEO_UNST_R8(NN,X,Y,Z) RESULT(E_IO)
00882         !--------------------------------------------------------------------------------------------------------------------------------
00883         !! FUNCTION FOR SAVING MESH; TOPOLOGY = UNSTRUCTURED\_GRID (R8P).
00884         !--------------------------------------------------------------------------------------------------------------------------------
00885 
00886         IMPLICIT NONE
00887 
00888         !--------------------------------------------------------------------------------------------------------------------------------
00889         INTEGER(I4P), INTENT(IN):: NN        ! NUMBER OF NODES
00890         REAL(R8P),    INTENT(IN):: X(1:NN)   ! X COORDINATES OF ALL NODES
00891         REAL(R8P),    INTENT(IN):: Y(1:NN)   ! Y COORDINATES OF ALL NODES
00892         REAL(R8P),    INTENT(IN):: Z(1:NN)   ! Z COORDINATES OF ALL NODES
00893         INTEGER(I4P)::             E_IO      ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00894         CHARACTER(LEN=MAXLEN)::    S_BUFFER  ! BUFFER STRING
00895         INTEGER(I4P)::             N1        ! COUNTER
00896         !--------------------------------------------------------------------------------------------------------------------------------
00897 
00898         !--------------------------------------------------------------------------------------------------------------------------------
00899         SELECT CASE(F_OUT)
00900         CASE(F_OUT_ASCII)
00901           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00902      &          'POINTS ',NN,' double'
00903           WRITE(UNIT=UNIT_VTK,FMT='(3'//FR8P//')',   IOSTAT=E_IO)
00904      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00905         CASE(F_OUT_BINARY)
00906           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00907      &          'POINTS ',NN,' double'
00908           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00909      &          TRIM(S_BUFFER)//END_REC
00910           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00911      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00912           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00913         ENDSELECT
00914         RETURN
00915         !--------------------------------------------------------------------------------------------------------------------------------
00916         END FUNCTION VTK_GEO_UNST_R8
00917 
00918         FUNCTION VTK_GEO_UNST_R4(NN,X,Y,Z) RESULT(E_IO)
00919         !--------------------------------------------------------------------------------------------------------------------------------
00920         !! FUNCTION FOR SAVING MESH; TOPOLOGY = UNSTRUCTURED\_GRID (R4P).
00921         !--------------------------------------------------------------------------------------------------------------------------------
00922 
00923         IMPLICIT NONE
00924 
00925         !--------------------------------------------------------------------------------------------------------------------------------
00926         INTEGER(I4P), INTENT(IN):: NN        ! NUMBER OF NODES
00927         REAL(R4P),    INTENT(IN):: X(1:NN)   ! X COORDINATES OF ALL NODES
00928         REAL(R4P),    INTENT(IN):: Y(1:NN)   ! Y COORDINATES OF ALL NODES
00929         REAL(R4P),    INTENT(IN):: Z(1:NN)   ! Z COORDINATES OF ALL NODES
00930         INTEGER(I4P)::             E_IO      ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00931         CHARACTER(LEN=MAXLEN)::    S_BUFFER  ! BUFFER STRING
00932         INTEGER(I4P)::             N1        ! COUNTER
00933         !--------------------------------------------------------------------------------------------------------------------------------
00934 
00935         !--------------------------------------------------------------------------------------------------------------------------------
00936         SELECT CASE(F_OUT)
00937         CASE(F_OUT_ASCII)
00938           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00939      &          'POINTS ',NN,' float'
00940           WRITE(UNIT=UNIT_VTK,FMT='(3'//FR4P//')',   IOSTAT=E_IO)
00941      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00942         CASE(F_OUT_BINARY)
00943           WRITE(S_BUFFER,     FMT='(A,'//FI4P//',A)',IOSTAT=E_IO)
00944      &          'POINTS ',NN,' float'
00945           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00946      &          TRIM(S_BUFFER)//END_REC
00947           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)
00948      &          (X(N1),Y(N1),Z(N1),N1=1,NN)
00949           WRITE(UNIT=UNIT_VTK,                       IOSTAT=E_IO)END_REC
00950         ENDSELECT
00951         RETURN
00952         !--------------------------------------------------------------------------------------------------------------------------------
00953         END FUNCTION VTK_GEO_UNST_R4
00954         !(DOC/)SKIPPEDBLOCK
00955 
00956         FUNCTION VTK_CON(NC,CONNECT,CELL_TYPE) RESULT(E_IO)
00957         !--------------------------------------------------------------------------------------------------------------------------------
00958         !!THIS FUNCTION \MAIUSCOLETTOBS{MUST} BE USED WHEN UNSTRUCTURED GRID IS USED. IT SAVES THE CONNECTIVITY OF THE UNSTRUCTURED
00959         !!MESH.
00960         !--------------------------------------------------------------------------------------------------------------------------------
00961 
00962         IMPLICIT NONE
00963 
00964         !--------------------------------------------------------------------------------------------------------------------------------
00965         INTEGER(I4P), INTENT(IN):: NC              ! NUMBER OF CELLS
00966         INTEGER(I4P), INTENT(IN):: CONNECT(:)      ! MESH CONNECTIVITY
00967         INTEGER(I4P), INTENT(IN):: CELL_TYPE(1:NC) ! VTK CELL TYPE
00968         INTEGER(I4P)::             E_IO            ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
00969         CHARACTER(LEN=MAXLEN)::    S_BUFFER        ! BUFFER STRING
00970         INTEGER(I4P)::             NCON            ! DIMENSION OF CONNECTIVITY VECTOR 
00971         !!THE VTK\_CON VARIABLES HAVE THE FOLLOWING MEANING:
00972         !!
00973         !!\BEGIN{DESCRIPTION}
00974         !! \ITEM[{\COLOR{ROYALBLUE}NC}] INDICATES THE NUMBER OF ALL CELLS.
00975         !! \ITEM[{\COLOR{ROYALBLUE}CONNECT}] CONTAINS THE CONNECTIVITY OF THE MESH. IT IS A VECTOR.
00976         !! \ITEM[{\COLOR{ROYALBLUE}CELL\_TYPE}] CONTAINS THE TYPE OF EVERY CELLS. IT IS A VECTOR OF $[1:NC]$.
00977         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
00978         !!\END{DESCRIPTION}
00979         !!
00980         !!THE VECTOR \MAIUSCOLETTOBS{CONNECT} MUST FOLLOW THE VTK LEGACY STANDARD. IT IS PASSED AS \MAIUSCOLETTOBS{ASSUMED-SHAPE} ARRAY
00981         !!BECAUSE ITS DIMENSIONS IS RELATED TO THE MESH DIMENSIONS IN A COMPLEX WAY. ITS DIMENSIONS CAN BE CALCULATED BY THE FOLLOWING
00982         !!EQUATION:
00983         !!
00984         !!\BEGIN{EQUATION}
00985         !!DC = NC + \SUM\LIMITS_{I = 1}^{NC} {NVERTEX_I }
00986         !!\LABEL{EQ:CONNECTIVITY DIMENSIONS}
00987         !!\END{EQUATION}
00988         !!
00989         !!\NOINDENT WHERE $DC$ IS CONNECTIVITY VECTOR DIMENSION AND $NVERTEX_I$ IS THE NUMBER OF VERTICES OF $I^{TH}$ CELL. THE VTK
00990         !!LEGACY STANDARD FOR THE MESH CONNECTIVITY IS QUITE OBSCURE AT LEAST AT FIRST SIGHT. IT IS MORE SIMPLE ANALIZING AN EXAMPLE.
00991         !!SUPPOSE WE HAVE A MESH COMPOSED BY 2 CELLS, ONE HEXAHEDRON (8 VERTICES) AND ONE PYRAMID WITH SQUARE BASIS (5 VERTICES); SUPPOSE
00992         !!THAT THE BASIS OF PYRAMID IS CONSTITUTE BY A FACE OF THE HEXAHEDRON AND SO THE TWO CELLS SHARE 4 VERTICES. THE EQUATION
00993         !!\REF{EQ:CONNECTIVITY DIMENSIONS} GIVES $DC=2+8+5=15$; THE CONNECTIVITY VECTOR FOR THIS MESH CAN BE:
00994         !!
00995         !!\BEGIN{BOXRED}{CONNECTIVITY VECTOR EXAMPLE FOR VTK LEGACY STANDARD}
00996         !!\BEGIN{VERBATIM}
00997         !!! FIRST CELL
00998         !!CONNECT(1)  = 8  => NUMBER OF VERTICES OF 1° CELL
00999         !!CONNECT(2)  = 0  => IDENTIFICATION FLAG OF 1° VERTEX OF 1° CELL
01000         !!CONNECT(3)  = 1  => IDENTIFICATION FLAG OF 2° VERTEX OF 1° CELL
01001         !!CONNECT(4)  = 2  => IDENTIFICATION FLAG OF 3° VERTEX OF 1° CELL
01002         !!CONNECT(5)  = 3  => IDENTIFICATION FLAG OF 4° VERTEX OF 1° CELL
01003         !!CONNECT(6)  = 4  => IDENTIFICATION FLAG OF 5° VERTEX OF 1° CELL
01004         !!CONNECT(7)  = 5  => IDENTIFICATION FLAG OF 6° VERTEX OF 1° CELL
01005         !!CONNECT(8)  = 6  => IDENTIFICATION FLAG OF 7° VERTEX OF 1° CELL
01006         !!CONNECT(9)  = 7  => IDENTIFICATION FLAG OF 8° VERTEX OF 1° CELL
01007         !!! SECOND CELL
01008         !!CONNECT(10) = 5  => NUMBER OF VERTICES OF 2° CELL
01009         !!CONNECT(11) = 0  => IDENTIFICATION FLAG OF 1° VERTEX OF 2° CELL
01010         !!CONNECT(12) = 1  => IDENTIFICATION FLAG OF 2° VERTEX OF 2° CELL
01011         !!CONNECT(13) = 2  => IDENTIFICATION FLAG OF 3° VERTEX OF 2° CELL
01012         !!CONNECT(14) = 3  => IDENTIFICATION FLAG OF 4° VERTEX OF 2° CELL
01013         !!CONNECT(15) = 8  => IDENTIFICATION FLAG OF 5° VERTEX OF 2° CELL
01014         !!\END{VERBATIM}
01015         !!\END{BOXRED}
01016         !!
01017         !!\NOINDENT NOTE THAT THE FIRST 4 IDENTIFICATION FLAGS OF PYRAMID VERTICES AS THE SAME OF THE FIRST 4 IDENTIFICATION FLAGS OF
01018         !!THE HEXAHEDRON BECAUSE THE TWO CELLS SHARE THIS FACE. IT IS ALSO IMPORTANT TO NOTE THAT THE IDENTIFICATION FLAGS START
01019         !!FORM $0$ VALUE: THIS IS IMPOSE TO THE VTK STANDARD. THE FUNCTION VTK\_CON DOES NOT CALCULATE THE CONNECTIVITY VECTOR: IT
01020         !!WRITES THE CONNECTIVITY VECTOR CONFORMING THE VTK STANDARD, BUT DOES NOT CALCULATE IT. IN THE FUTURE RELEASE OF \LIBVTKIO WILL
01021         !!BE INCLUDED A FUNCTION TO CALCULATE THE CONNECTIVITY VECTOR.
01022         !!
01023         !!THE VECTOR VARIABLE \MAIUSCOLETTOBS{TIPO} MUST CONFORM THE VTK STANDARD \FOOTNOTE{SEE THE FILE VTK-STANDARD AT THE KITWARE
01024         !!HOMEPAGE.}. IT CONTAINS THE \EMPH{TYPE} OF EACH CELLS. FOR THE ABOVE EXAMPLE THIS VECTOR IS:
01025         !!
01026         !!\BEGIN{BOXRED}{CELL-TYPE VECTOR EXAMPLE FOR VTK LEGACY STANDARD}
01027         !!\BEGIN{VERBATIM}
01028         !!TIPO(1) = 12  => VTK HEXAHEDRON TYPE OF 1° CELL
01029         !!TIPO(2) = 14  => VTK PYRAMID TYPE OF 2° CELL
01030         !!\END{VERBATIM}
01031         !!\END{BOXRED}
01032         !!
01033         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_CON CALLING:
01034         !!
01035         !!\BEGIN{BOXRED}{VTK\_CON CALLING}
01036         !!\BEGIN{VERBATIM}
01037         !!...
01038         !!INTEGER(4), PARAMETER:: NC=2
01039         !!INTEGER(4), PARAMETER:: NVERTEX1=8
01040         !!INTEGER(4), PARAMETER:: NVERTEX2=5
01041         !!INTEGER(4), PARAMETER:: DC=NC+NVERTEX1+NVERTEX2
01042         !!INTEGER(4)::            CONNECT(1:DC)
01043         !!INTEGER(4)::            CELL_TYPE(1:NC)
01044         !!...
01045         !!E_IO = VTK_CON(NC,CONNECT,CELL_TYPE)
01046         !!...
01047         !!\END{VERBATIM}
01048         !!\END{BOXRED}
01049         !--------------------------------------------------------------------------------------------------------------------------------
01050 
01051         !--------------------------------------------------------------------------------------------------------------------------------
01052         NCON = SIZE(CONNECT,1)
01053         SELECT CASE(F_OUT)
01054         CASE(F_OUT_ASCII)
01055           WRITE(UNIT=UNIT_VTK,FMT='(A,2'//FI4P//')',IOSTAT=E_IO)
01056      &          'CELLS ',NC,NCON
01057           WRITE(UNIT=UNIT_VTK,FMT=FI4P,             IOSTAT=E_IO)CONNECT
01058           WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//')', IOSTAT=E_IO)
01059      &          'CELL_TYPES ',NC
01060           WRITE(UNIT=UNIT_VTK,FMT=FI4P,             IOSTAT=E_IO)
01061      &          CELL_TYPE
01062         CASE(F_OUT_BINARY)
01063           WRITE(S_BUFFER,     FMT='(A,2'//FI4P//')',IOSTAT=E_IO)
01064      &          'CELLS ',NC,NCON
01065           WRITE(UNIT=UNIT_VTK,                      IOSTAT=E_IO)
01066      &          TRIM(S_BUFFER)//END_REC
01067           WRITE(UNIT=UNIT_VTK,                      IOSTAT=E_IO)CONNECT
01068           WRITE(UNIT=UNIT_VTK,                      IOSTAT=E_IO)END_REC
01069           WRITE(S_BUFFER,     FMT='(A,'//FI4P//')', IOSTAT=E_IO)
01070      &          'CELL_TYPES ',NC
01071           WRITE(UNIT=UNIT_VTK,                      IOSTAT=E_IO)
01072      &          TRIM(S_BUFFER)//END_REC
01073           WRITE(UNIT=UNIT_VTK,                      IOSTAT=E_IO)
01074      &          CELL_TYPE
01075           WRITE(UNIT=UNIT_VTK,                      IOSTAT=E_IO)END_REC
01076         ENDSELECT
01077         RETURN
01078         !--------------------------------------------------------------------------------------------------------------------------------
01079         END FUNCTION VTK_CON
01080 
01081         FUNCTION VTK_DAT(NC_NN,VAR_LOCATION) RESULT(E_IO)
01082         !--------------------------------------------------------------------------------------------------------------------------------
01083         !!THIS FUNCTION \MAIUSCOLETTOBS{MUST} BE CALLED BEFORE SAVING THE DATA RELATED TO GEOMETRIC MESH. THIS FUNCTION INITIALIZES THE
01084         !!SAVING OF DATA VARIABLES INDICATING THE \EMPH{TYPE} OF VARIABLES THAT WILL BE SAVED.
01085         !--------------------------------------------------------------------------------------------------------------------------------
01086 
01087         IMPLICIT NONE
01088 
01089         !--------------------------------------------------------------------------------------------------------------------------------
01090         INTEGER(I4P), INTENT(IN):: NC_NN        ! NUMBER OF CELLS OR NODES OF FIELD
01091         CHARACTER(*), INTENT(IN):: VAR_LOCATION ! LOCATION OF SAVING VARIABLES: CELL FOR CELL-CENTERED, NODE FOR NODE-CENTERED
01092         INTEGER(I4P)::             E_IO         ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01093         CHARACTER(LEN=MAXLEN)::    S_BUFFER     ! BUFFER STRING
01094         !!THE VTK\_DAT VARIABLES HAVE THE FOLLOWING MEANING:
01095         !!
01096         !!\BEGIN{DESCRIPTION}
01097         !! \ITEM[{\COLOR{ROYALBLUE}NC\_NN}] INDICATES THE NUMBER OF ALL CELLS OR ALL NODES ACCORDING TO THE VALUE OF {\COLOR{ROYALBLUE}TIPO}.
01098         !! \ITEM[{\COLOR{ROYALBLUE}VAR\_LOCATION}] CONTAINS THE LOCATION-TYPE OF VARIABLES THAT WILL BE SAVED AFTER VTK\_DAT. IT IS A SCALAR AND CAB ASSUME THE FOLLOWING VALUES:
01099         !! \BEGIN{ENUMERATEABLU}
01100         !!  \ITEM \EMPH{CELL} (IT IS CASE INSENSITIVE) $\RIGHTARROW$ VARIABLES WILL BE CELL-CENTERED.
01101         !!  \ITEM \EMPH{NODE} (IT IS CASE INSENSITIVE) $\RIGHTARROW$ VARIABLES WILL BE NODE-CENTERED.
01102         !! \END{ENUMERATEABLU}
01103         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
01104         !!\END{DESCRIPTION}
01105         !!
01106         !!OF COURSE A SINGLE FILE CAN CONTAIN BOTH CELL AND NODE CENTERED VARIABLES; IN THIS CASE THE VTK\_DAT FUNCTION MUST BE CALLED TWO TIMES, BEFORE SAVING CELL-CENTERED VARIABLES AND BEFORE SAVING NODE-CENTERED VARIABLES.
01107         !!
01108         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_DAT CALLING:
01109         !!
01110         !!\BEGIN{BOXRED}{VTK\_DAT CALLING}
01111         !!\BEGIN{VERBATIM}
01112         !!...
01113         !!E_IO = VTK_DAT(50,'NODE')
01114         !!...
01115         !!\END{VERBATIM}
01116         !!\END{BOXRED}
01117         !--------------------------------------------------------------------------------------------------------------------------------
01118 
01119         !--------------------------------------------------------------------------------------------------------------------------------
01120         SELECT CASE(F_OUT)
01121         CASE(F_OUT_ASCII)
01122           SELECT CASE(TRIM(UPPER_CASE(VAR_LOCATION)))
01123           CASE('CELL')
01124             WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//')',IOSTAT=E_IO)
01125      &            'CELL_DATA ',NC_NN
01126           CASE('NODE')
01127             WRITE(UNIT=UNIT_VTK,FMT='(A,'//FI4P//')',IOSTAT=E_IO)
01128      &            'POINT_DATA ',NC_NN
01129           ENDSELECT
01130         CASE(F_OUT_BINARY)
01131           SELECT CASE(TRIM(UPPER_CASE(VAR_LOCATION)))
01132           CASE('CELL')
01133             WRITE(S_BUFFER,     FMT='(A,'//FI4P//')',IOSTAT=E_IO)
01134      &          'CELL_DATA ',NC_NN
01135             WRITE(UNIT=UNIT_VTK,                     IOSTAT=E_IO)
01136      &          TRIM(S_BUFFER)//END_REC
01137           CASE('NODE')
01138             WRITE(S_BUFFER,     FMT='(A,'//FI4P//')',IOSTAT=E_IO)
01139      &          'POINT_DATA ',NC_NN
01140             WRITE(UNIT=UNIT_VTK,                     IOSTAT=E_IO)
01141      &          TRIM(S_BUFFER)//END_REC
01142           ENDSELECT
01143         ENDSELECT
01144         RETURN
01145         !--------------------------------------------------------------------------------------------------------------------------------
01146         END FUNCTION VTK_DAT
01147 
01148         !!\SECTION{VTK\_VAR}
01149         !!
01150         !!VTK\_VAR IS AN INTERFACE TO 8 DIFFERENT FUNCTIONS; THERE ARE 3 FUNCTIONS FOR SCALAR VARIABLES, 3 FUNCTIONS FOR VECTORIAL
01151         !!VARIABLES AND 2 FUNCTION TEXTURE VARIABLES.
01152         !!THIS FUNCTION SAVES THE DATA VARIABLES RELATED TO GEOMETRIC MESH. THE INPUTS THAT MUST BE PASSED CHANGE DEPENDING ON THE DATA
01153         !!VARIABLES TYPE.
01154         !!
01155         !!\SUBSECTION{VTK\_VAR SCALAR DATA}
01156         !!
01157         !!\BEGIN{BOXRED}{}
01158         !!\BEGIN{LSTLISTING}[STYLE=SIGNATURE,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR SCALAR DATA SIGNATURE}]
01159         !!FUNCTION VTK_VAR(FORMATO,NC_NN,VARNAME,VAR) RESULT(E_IO)
01160         !!\END{LSTLISTING}
01161         !!\END{BOXRED}
01162         !!
01163         !!THIS KIND OF CALL IS USED TO SAVE SCALAR DATA.
01164         !!
01165         !!\BEGIN{BOXRED}{}
01166         !!\BEGIN{LSTLISTING}[STYLE=VARIABLES,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR SCALAR DATA VARIABLES}]
01167         !!INTEGER(I4P),                     INTENT(IN):: NC_NN        ! NUMBER OF NODES OR CELLS
01168         !!CHARACTER(*),                     INTENT(IN):: VARNAME      ! VARIABLE NAME
01169         !!REAL(R8P OR R4P) OR INTEGER(I4P), INTENT(IN):: VAR(1:NC_NN) ! VARIABLE TO BE SAVED
01170         !!INTEGER(I4P)::                                 E_IO         ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01171         !!\END{LSTLISTING}
01172         !!\END{BOXRED}
01173         !!
01174         !!THE VTK\_VAR VARIABLES HAVE THE FOLLOWING MEANING:
01175         !!
01176         !!\BEGIN{DESCRIPTION}
01177         !! \ITEM[{\COLOR{ROYALBLUE}NC\_NN}] INDICATES THE NUMBER OF ALL CELLS OR ALL NODES ACCORDING TO THE VALUE OF
01178         !!                                  {\COLOR{ROYALBLUE}TIPO} PASSED TO VTK\_DAT.
01179         !! \ITEM[{\COLOR{ROYALBLUE}VARNAME}] CONTAINS THE NAME ATTRIBUITED THE VARIABLE SAVED.
01180         !! \ITEM[{\COLOR{ROYALBLUE}VAR}] CONTAINS THE VALUES OF VARIABLES IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01181         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
01182         !!\END{DESCRIPTION}
01183         !!
01184         !!NOTE THAT THE VARIABLES \TEXTTT{VAR} CAN BE PASSED BOTH AS 8-BYTE REAL KIND, 4-BYTE REAL KIND AND 4-BYTE INTEGER; THE
01185         !!DYNAMIC DISPLACEMENT INTERFACE WILL CALL THE CORRECT FUNCTION.
01186         !!
01187         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_VAR SCALAR DATA CALLING:
01188         !!
01189         !!\BEGIN{BOXRED}{VTK\_VAR SCALAR DATA CALLING}
01190         !!\BEGIN{VERBATIM}
01191         !!...
01192         !!INTEGER(4), PARAMETER:: NC_NN=100
01193         !!REAL(4)::               VAR(1:NC_NN)
01194         !!...
01195         !!E_IO = VTK_VAR(NC_NN,'SCALAR DATA',VAR)
01196         !!...
01197         !!\END{VERBATIM}
01198         !!\END{BOXRED}
01199         !!
01200         !!\SUBSECTION{VTK\_VAR REAL VECTORIAL DATA}
01201         !!
01202         !!\BEGIN{BOXRED}{}
01203         !!\BEGIN{LSTLISTING}[STYLE=SIGNATURE,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR REAL VECTORIAL DATA SIGNATURE}]
01204         !!FUNCTION VTK_VAR(TIPO,NC_NN,VARNAME,VARX,VARY,VARZ) RESULT(E_IO)
01205         !!\END{LSTLISTING}
01206         !!\END{BOXRED}
01207         !!
01208         !!THIS KIND OF CALL IS USED TO SAVE REAL VECTORIAL DATA.
01209         !!
01210         !!\BEGIN{BOXRED}{}
01211         !!\BEGIN{LSTLISTING}[STYLE=VARIABLES,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR REAL VECTORIAL DATA VARIABLES}]
01212         !!CHARACTER(*),     INTENT(IN):: VEC_TYPE      ! VECTOR TYPE: VECT = GENERIC VECTOR , NORM = NORMAL VECTOR
01213         !!INTEGER(I4P),     INTENT(IN):: NC_NN         ! NUMBER OF NODES OR CELLS
01214         !!CHARACTER(*),     INTENT(IN):: VARNAME       ! VARIABLE NAME
01215         !!REAL(R8P OR R4P), INTENT(IN):: VARX(1:NC_NN) ! X COMPONENT OF VECTOR
01216         !!REAL(R8P OR R4P), INTENT(IN):: VARY(1:NC_NN) ! Y COMPONENT OF VECTOR
01217         !!REAL(R8P OR R4P), INTENT(IN):: VARZ(1:NC_NN) ! Z COMPONENT OF VECTOR
01218         !!INTEGER(I4P)::                 E_IO          ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01219         !!\END{LSTLISTING}
01220         !!\END{BOXRED}
01221         !!
01222         !!THE VTK\_VAR VARIABLES HAVE THE FOLLOWING MEANING:
01223         !!
01224         !!\BEGIN{DESCRIPTION}
01225         !! \ITEM [{\COLOR{ROYALBLUE}TIPO}] INDICATES THE TYPE OF VECTOR. IT CAN ASSUME THE FOLLOWING VALUE:
01226         !! \BEGIN{ENUMERATEABLU}
01227         !!  \ITEM \EMPH{VECT} $\RIGHTARROW$ GENERIC VECTOR.
01228         !!  \ITEM \EMPH{NORM} $\RIGHTARROW$ NORMAL VECTOR OF FACE.
01229         !! \END{ENUMERATEABLU}
01230         !! \ITEM[{\COLOR{ROYALBLUE}NC\_NN}] INDICATES THE NUMBER OF ALL CELLS OR ALL NODES ACCORDING TO THE VALUE OF
01231         !!                                  {\COLOR{ROYALBLUE}TIPO} PASSED TO VTK\_DAT.
01232         !! \ITEM[{\COLOR{ROYALBLUE}VARNAME}] CONTAINS THE NAME ATTRIBUITED THE VARIABLE SAVED.
01233         !! \ITEM[{\COLOR{ROYALBLUE}VARX}] CONTAINS THE VALUES OF $X$ COMPONENT IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01234         !! \ITEM[{\COLOR{ROYALBLUE}VARY}] CONTAINS THE VALUES OF $Y$ COMPONENT IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01235         !! \ITEM[{\COLOR{ROYALBLUE}VARZ}] CONTAINS THE VALUES OF $Z$ COMPONENT IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01236         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
01237         !!\END{DESCRIPTION}
01238         !!
01239         !!NOTE THAT THE VARIABLES \TEXTTT{VARX,VARY,VARZ} CAN BE PASSED BOTH AS 8-BYTE REAL KIND AND 4-BYTE REAL KIND; THE DYNAMIC
01240         !!DISPLACEMENT INTERFACE WILL CALL THE CORRECT FUNCTION.
01241         !!
01242         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_VAR REAL VECTORIAL DATA CALLING:
01243         !!
01244         !!\BEGIN{BOXRED}{VTK\_VAR REAL VECTORIAL DATA CALLING}
01245         !!\BEGIN{VERBATIM}
01246         !!...
01247         !!INTEGER(4), PARAMETER:: NC_NN=100
01248         !!REAL(4)::               VARX(1:NC_NN)
01249         !!REAL(4)::               VARZ(1:NC_NN)
01250         !!REAL(4)::               VARZ(1:NC_NN)
01251         !!...
01252         !!E_IO = VTK_VAR('VECT',NC_NN,'REAL VECTORIAL DATA',...
01253         !!            ...VARX,VARY,VARZ)
01254         !!...
01255         !!\END{VERBATIM}
01256         !!\END{BOXRED}
01257         !!
01258         !!\SUBSECTION{VTK\_VAR INTEGER VECTORIAL DATA}
01259         !!
01260         !!\BEGIN{BOXRED}{}
01261         !!\BEGIN{LSTLISTING}[STYLE=SIGNATURE,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR INTEGER VECTORIAL DATA SIGNATURE}]
01262         !!FUNCTION VTK_VAR(NC_NN,VARNAME,VARX,VARY,VARZ) RESULT(E_IO)
01263         !!\END{LSTLISTING}
01264         !!\END{BOXRED}
01265         !!
01266         !!THIS KIND OF CALL IS USED TO SAVE INTEGER VECTORIAL DATA.
01267         !!
01268         !!\BEGIN{BOXRED}{}
01269         !!\BEGIN{LSTLISTING}[STYLE=VARIABLES,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR INTEGER VECTORIAL DATA VARIABLES}]
01270         !!INTEGER(R4P),   INTENT(IN):: NC_NN         ! NUMBER OF NODES OR CELLS
01271         !!CHARACTER(*),   INTENT(IN):: VARNAME       ! VARIABLE NAME
01272         !!INTEGER(R4P),   INTENT(IN):: VARX(1:NC_NN) ! X COMPONENT OF VECTOR
01273         !!INTEGER(R4P),   INTENT(IN):: VARY(1:NC_NN) ! Y COMPONENT OF VECTOR
01274         !!INTEGER(R4P),   INTENT(IN):: VARZ(1:NC_NN) ! Z COMPONENT OF VECTOR
01275         !!INTEGER(R4P)::               E_IO          ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01276         !!\END{LSTLISTING}
01277         !!\END{BOXRED}
01278         !!
01279         !!THE VTK\_VAR VARIABLES HAVE THE FOLLOWING MEANING:
01280         !!
01281         !!\BEGIN{DESCRIPTION}
01282         !! \ITEM[{\COLOR{ROYALBLUE}NC\_NN}] INDICATES THE NUMBER OF ALL CELLS OR ALL NODES ACCORDING TO THE VALUE OF
01283         !!                                  {\COLOR{ROYALBLUE}TIPO} PASSED TO VTK\_DAT.
01284         !! \ITEM[{\COLOR{ROYALBLUE}VARNAME}] CONTAINS THE NAME ATTRIBUITED THE VARIABLE SAVED.
01285         !! \ITEM[{\COLOR{ROYALBLUE}VARX}] CONTAINS THE VALUES OF $X$ COMPONENT IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01286         !! \ITEM[{\COLOR{ROYALBLUE}VARY}] CONTAINS THE VALUES OF $Y$ COMPONENT IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01287         !! \ITEM[{\COLOR{ROYALBLUE}VARZ}] CONTAINS THE VALUES OF $Z$ COMPONENT IN EACH NODES OR CELLS. IT IS A VECTOR OF $[1:NC\_NN]$.
01288         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
01289         !!\END{DESCRIPTION}
01290         !!
01291         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_VAR REAL VECTORIAL DATA CALLING:
01292         !!
01293         !!\BEGIN{BOXRED}{VTK\_VAR INTEGER VECTORIAL DATA CALLING}
01294         !!\BEGIN{VERBATIM}
01295         !!...
01296         !!INTEGER(4), PARAMETER:: NC_NN=100
01297         !!INTEGER(4)::            VARX(1:NC_NN)
01298         !!INTEGER(4)::            VARZ(1:NC_NN)
01299         !!INTEGER(4)::            VARZ(1:NC_NN)
01300         !!...
01301         !!E_IO = VTK_VAR(NC_NN,'INTEGER VECTORIAL DATA', &
01302         !!               VARX,VARY,VARZ)
01303         !!...
01304         !!\END{VERBATIM}
01305         !!\END{BOXRED}
01306         !!
01307         !!\SUBSECTION{VTK\_VAR TEXTURE DATA}
01308         !!
01309         !!\BEGIN{BOXRED}{}
01310         !!\BEGIN{LSTLISTING}[STYLE=SIGNATURE,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR TEXTURE DATA SIGNATURE}]
01311         !!FUNCTION VTK_VAR(NC_NN,,DIMM,VARNAME,TEXTCOO) RESULT(E_IO)
01312         !!\END{LSTLISTING}
01313         !!\END{BOXRED}
01314         !!
01315         !!THIS KIND OF CALL IS USED TO SAVE TEXTURE DATA.
01316         !!
01317         !!\BEGIN{BOXRED}{}
01318         !!\BEGIN{LSTLISTING}[STYLE=VARIABLES,TITLE=\COLOR{MAROON}\MAIUSCOLETTOBS{VTK\_VAR TEXTURE DATA VARIABLES}]
01319         !!INTEGER(R4P),     INTENT(IN):: NC_NN                   ! NUMBER OF NODES OR CELLS
01320         !!INTEGER(R4P),     INTENT(IN):: DIMM                    ! TEXTURE DIMENSIONS
01321         !!CHARACTER(*),     INTENT(IN):: VARNAME                 ! VARIABLE NAME
01322         !!REAL(R8P OR R4P), INTENT(IN):: TEXTCOO(1:NC_NN,1:DIMM) ! TEXTURE
01323         !!INTEGER(R4P)::                 E_IO                    ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01324         !!\END{LSTLISTING}
01325         !!\END{BOXRED}
01326         !!
01327         !!THE VTK\_VAR VARIABLES HAVE THE FOLLOWING MEANING:
01328         !!
01329         !!\BEGIN{DESCRIPTION}
01330         !! \ITEM[{\COLOR{ROYALBLUE}NC\_NN}] INDICATES THE NUMBER OF ALL CELLS OR ALL NODES ACCORDING TO THE VALUE OF
01331         !!                                  {\COLOR{ROYALBLUE}TIPO} PASSED TO VTK\_DAT.
01332         !! \ITEM[{\COLOR{ROYALBLUE}DIMM}] INDICATES THE DIMENSIONS OF THE TEXTURE COORDINATES. IT CAN ASSUME THE VALUE:
01333         !! \BEGIN{ENUMERATEABLU}
01334         !!  \ITEM \EMPH{1} $\RIGHTARROW$ SCALAR TEXTURE.
01335         !!  \ITEM \EMPH{2} $\RIGHTARROW$ TWODIMENSIONAL TEXTURE.
01336         !!  \ITEM \EMPH{3} $\RIGHTARROW$ THREEDIMENSIONAL TEXTURE.
01337         !! \END{ENUMERATEABLU}
01338         !! \ITEM[{\COLOR{ROYALBLUE}VARNAME}] CONTAINS THE NAME ATTRIBUITED THE VARIABLE SAVED.
01339         !! \ITEM[{\COLOR{ROYALBLUE}TEXTCOO}] CONTAINS THE COORDINATES OF TEXTURE IN EACH NODES OR CELLS. IT IS A VECTOR OF
01340         !!                                   $[1:NC\_NN,1:DIMM]$.
01341         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
01342         !!\END{DESCRIPTION}
01343         !!
01344         !!NOTE THAT THE VARIABLE \TEXTTT{TEXTCOO} CAN BE PASSED BOTH AS 8-BYTE REAL KIND AND 4-BYTE REAL KIND; THE DYNAMIC
01345         !!DISPLACEMENT INTERFACE WILL CALL THE CORRECT FUNCTION.
01346         !!
01347         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_VAR TEXTURE DATA CALLING:
01348         !!
01349         !!\BEGIN{BOXRED}{VTK\_VAR TEXTURE DATA CALLING}
01350         !!\BEGIN{VERBATIM}
01351         !!...
01352         !!INTEGER(4), PARAMETER:: NC_NN=100
01353         !!INTEGER(4), PARAMETER:: DIMM=2
01354         !!REAL(4)::               TEXTCOO(1:NC_NN,1:DIMM)
01355         !!...
01356         !!E_IO = VTK_VAR(NC_NN,DIMM,'TEXTURE DATA',TEXTCOO)
01357         !!...
01358         !!\END{VERBATIM}
01359         !!\END{BOXRED}
01360         !!
01361         !(\DOC)SKIPPEDBLOCK
01362         FUNCTION VTK_VAR_SCAL_R8(NC_NN,VARNAME,VAR) RESULT(E_IO)
01363         !--------------------------------------------------------------------------------------------------------------------------------
01364         !! FUNCTION FOR SAVING FIELD OF SCALAR VARIABLE (R8P).
01365         !--------------------------------------------------------------------------------------------------------------------------------
01366 
01367         IMPLICIT NONE
01368 
01369         !--------------------------------------------------------------------------------------------------------------------------------
01370         INTEGER(I4P), INTENT(IN):: NC_NN        ! NUMBER OF NODES OR CELLS
01371         CHARACTER(*), INTENT(IN):: VARNAME      ! VARIABLE NAME
01372         REAL(R8P),    INTENT(IN):: VAR(1:NC_NN) ! VARIABLE TO BE SAVED
01373         INTEGER(I4P)::             E_IO         ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01374         !--------------------------------------------------------------------------------------------------------------------------------
01375 
01376         !--------------------------------------------------------------------------------------------------------------------------------
01377         SELECT CASE(F_OUT)
01378         CASE(F_OUT_ASCII)
01379           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)'SCALARS '//
01380      &          TRIM(VARNAME)//' double 1'
01381           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)
01382      &          'LOOKUP_TABLE default'
01383           WRITE(UNIT=UNIT_VTK,FMT=FR8P, IOSTAT=E_IO)VAR
01384         CASE(F_OUT_BINARY)
01385           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'SCALARS '//TRIM(VARNAME)//
01386      &          ' double 1'//END_REC
01387           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'LOOKUP_TABLE default'//
01388      &          END_REC
01389           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)VAR
01390           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)END_REC
01391         ENDSELECT
01392         RETURN
01393         !--------------------------------------------------------------------------------------------------------------------------------
01394         END FUNCTION VTK_VAR_SCAL_R8
01395 
01396         FUNCTION VTK_VAR_SCAL_R4(NC_NN,VARNAME,VAR) RESULT(E_IO)
01397         !--------------------------------------------------------------------------------------------------------------------------------
01398         !! FUNCTION FOR SAVING FIELD OF SCALAR VARIABLE (R4P).
01399         !--------------------------------------------------------------------------------------------------------------------------------
01400 
01401         IMPLICIT NONE
01402 
01403         !--------------------------------------------------------------------------------------------------------------------------------
01404         INTEGER(I4P), INTENT(IN):: NC_NN        ! NUMBER OF NODES OR CELLS
01405         CHARACTER(*), INTENT(IN):: VARNAME      ! VARIABLE NAME
01406         REAL(R4P),    INTENT(IN):: VAR(1:NC_NN) ! VARIABLE TO BE SAVED
01407         INTEGER(I4P)::             E_IO         ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01408         !--------------------------------------------------------------------------------------------------------------------------------
01409 
01410         !--------------------------------------------------------------------------------------------------------------------------------
01411         SELECT CASE(F_OUT)
01412         CASE(F_OUT_ASCII)
01413           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)'SCALARS '//
01414      &          TRIM(VARNAME)//' float 1'
01415           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)
01416      &          'LOOKUP_TABLE default'
01417           WRITE(UNIT=UNIT_VTK,FMT=FR4P, IOSTAT=E_IO)VAR
01418         CASE(F_OUT_BINARY)
01419           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'SCALARS '//TRIM(VARNAME)//
01420      &          ' float 1'//END_REC
01421           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'LOOKUP_TABLE default'//
01422      &          END_REC
01423           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)VAR
01424           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)END_REC
01425         ENDSELECT
01426         RETURN
01427         !--------------------------------------------------------------------------------------------------------------------------------
01428         END FUNCTION VTK_VAR_SCAL_R4
01429 
01430         FUNCTION VTK_VAR_SCAL_I4(NC_NN,VARNAME,VAR) RESULT(E_IO)
01431         !--------------------------------------------------------------------------------------------------------------------------------
01432         !! FUNCTION FOR SAVING FIELD OF SCALAR VARIABLE (I4P).
01433         !--------------------------------------------------------------------------------------------------------------------------------
01434 
01435         IMPLICIT NONE
01436 
01437         !--------------------------------------------------------------------------------------------------------------------------------
01438         INTEGER(I4P), INTENT(IN):: NC_NN        ! NUMBER OF NODES OR CELLS
01439         CHARACTER(*), INTENT(IN):: VARNAME      ! VARIABLE NAME
01440         INTEGER(I4P), INTENT(IN):: VAR(1:NC_NN) ! VARIABLE TO BE SAVED
01441         INTEGER(I4P)::             E_IO         ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01442         !--------------------------------------------------------------------------------------------------------------------------------
01443 
01444         !--------------------------------------------------------------------------------------------------------------------------------
01445         SELECT CASE(F_OUT)
01446         CASE(F_OUT_ASCII)
01447           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)'SCALARS '//
01448      &          TRIM(VARNAME)//' int 1'
01449           WRITE(UNIT=UNIT_VTK,FMT='(A)',IOSTAT=E_IO)
01450      &          'LOOKUP_TABLE default'
01451           WRITE(UNIT=UNIT_VTK,FMT=FI4P, IOSTAT=E_IO)VAR
01452         CASE(F_OUT_BINARY)
01453           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'SCALARS '//TRIM(VARNAME)//
01454      &          ' int 1'//END_REC
01455           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'LOOKUP_TABLE default'//
01456      &          END_REC
01457           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)VAR
01458           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)END_REC
01459         ENDSELECT
01460         RETURN
01461         !--------------------------------------------------------------------------------------------------------------------------------
01462         END FUNCTION VTK_VAR_SCAL_I4
01463 
01464         FUNCTION VTK_VAR_VECT_R8(VEC_TYPE,NC_NN,VARNAME,VARX,VARY,VARZ)
01465      &           RESULT(E_IO)
01466         !--------------------------------------------------------------------------------------------------------------------------------
01467         !! FUNCTION FOR SAVING FIELD OF VECTORIAL VARIABLE (R8P).
01468         !--------------------------------------------------------------------------------------------------------------------------------
01469 
01470         IMPLICIT NONE
01471 
01472         !--------------------------------------------------------------------------------------------------------------------------------
01473         CHARACTER(*), INTENT(IN):: VEC_TYPE      ! VECTOR TYPE: VECT = GENERIC VECTOR , NORM = NORMAL VECTOR
01474         INTEGER(I4P), INTENT(IN):: NC_NN         ! NUMBER OF NODES OR CELLS
01475         CHARACTER(*), INTENT(IN):: VARNAME       ! VARIABLE NAME
01476         REAL(R8P),    INTENT(IN):: VARX(1:NC_NN) ! X COMPONENT OF VECTOR
01477         REAL(R8P),    INTENT(IN):: VARY(1:NC_NN) ! Y COMPONENT OF VECTOR
01478         REAL(R8P),    INTENT(IN):: VARZ(1:NC_NN) ! Z COMPONENT OF VECTOR
01479         INTEGER(I4P)::             E_IO          ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01480         INTEGER(I8P)::             N1            ! COUNTER
01481         !--------------------------------------------------------------------------------------------------------------------------------
01482 
01483         !--------------------------------------------------------------------------------------------------------------------------------
01484         SELECT CASE(F_OUT)
01485         CASE(F_OUT_ASCII)
01486           SELECT CASE(UPPER_CASE(TRIM(VEC_TYPE)))
01487           CASE('VECT')
01488             WRITE(UNIT=UNIT_VTK,FMT='(A)',          IOSTAT=E_IO)
01489      &          'VECTORS '//TRIM(VARNAME)//' double'
01490           CASE('NORM')
01491             WRITE(UNIT=UNIT_VTK,FMT='(A)',          IOSTAT=E_IO)
01492      &          'NORMALS '//TRIM(VARNAME)//' double'
01493           ENDSELECT
01494           WRITE(UNIT=UNIT_VTK,FMT='(3'//FR8P//')',IOSTAT=E_IO)
01495      &          (VARX(N1),VARY(N1),VARZ(N1),N1=1,NC_NN)
01496         CASE(F_OUT_BINARY)
01497           SELECT CASE(UPPER_CASE(TRIM(VEC_TYPE)))
01498           CASE('VECT')
01499             WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'VECTORS '//TRIM(VARNAME)//
01500      &          ' double'//END_REC
01501           CASE('NORM')
01502             WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'NORMALS '//TRIM(VARNAME)//
01503      &          ' double'//END_REC
01504           ENDSELECT
01505           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)
01506      &          (VARX(N1),VARY(N1),VARZ(N1),N1=1,NC_NN)
01507           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)END_REC
01508         ENDSELECT
01509         RETURN
01510         !--------------------------------------------------------------------------------------------------------------------------------
01511         END FUNCTION VTK_VAR_VECT_R8
01512 
01513         FUNCTION VTK_VAR_VECT_R4(VEC_TYPE,NC_NN,VARNAME,VARX,VARY,VARZ)
01514      &          RESULT(E_IO)
01515         !--------------------------------------------------------------------------------------------------------------------------------
01516         !! FUNCTION FOR SAVING FIELD OF VECTORIAL VARIABLE (R4P).
01517         !--------------------------------------------------------------------------------------------------------------------------------
01518 
01519         IMPLICIT NONE
01520 
01521         !--------------------------------------------------------------------------------------------------------------------------------
01522         CHARACTER(*), INTENT(IN):: VEC_TYPE      ! VECTOR TYPE: VECT = GENERIC VECTOR , NORM = NORMAL VECTOR
01523         INTEGER(I4P), INTENT(IN):: NC_NN         ! NUMBER OF NODES OR CELLS
01524         CHARACTER(*), INTENT(IN):: VARNAME       ! VARIABLE NAME
01525         REAL(R4P),    INTENT(IN):: VARX(1:NC_NN) ! X COMPONENT OF VECTOR
01526         REAL(R4P),    INTENT(IN):: VARY(1:NC_NN) ! Y COMPONENT OF VECTOR
01527         REAL(R4P),    INTENT(IN):: VARZ(1:NC_NN) ! Z COMPONENT OF VECTOR
01528         INTEGER(I4P)::             E_IO          ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01529         INTEGER(I8P)::             N1            ! COUNTER
01530         !--------------------------------------------------------------------------------------------------------------------------------
01531 
01532         !--------------------------------------------------------------------------------------------------------------------------------
01533         SELECT CASE(F_OUT)
01534         CASE(F_OUT_ASCII)
01535           SELECT CASE(UPPER_CASE(TRIM(VEC_TYPE)))
01536           CASE('VECT')
01537             WRITE(UNIT=UNIT_VTK,FMT='(A)',          IOSTAT=E_IO)
01538      &          'VECTORS '//TRIM(VARNAME)//' float'
01539           CASE('NORM')
01540             WRITE(UNIT=UNIT_VTK,FMT='(A)',          IOSTAT=E_IO)
01541      &          'NORMALS '//TRIM(VARNAME)//' float'
01542           ENDSELECT
01543           WRITE(UNIT=UNIT_VTK,FMT='(3'//FR4P//')',IOSTAT=E_IO)
01544      &          (VARX(N1),VARY(N1),VARZ(N1),N1=1,NC_NN)
01545         CASE(F_OUT_BINARY)
01546           SELECT CASE(UPPER_CASE(TRIM(VEC_TYPE)))
01547           CASE('VECT')
01548             WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'VECTORS '//TRIM(VARNAME)//
01549      &          ' float'//END_REC
01550           CASE('NORM')
01551             WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'NORMALS '//TRIM(VARNAME)//
01552      &          ' float'//END_REC
01553           ENDSELECT
01554           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)
01555      &          (VARX(N1),VARY(N1),VARZ(N1),N1=1,NC_NN)
01556           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)END_REC
01557         ENDSELECT
01558         RETURN
01559         !--------------------------------------------------------------------------------------------------------------------------------
01560         END FUNCTION VTK_VAR_VECT_R4
01561 
01562         FUNCTION VTK_VAR_VECT_I4(NC_NN,VARNAME,VARX,VARY,VARZ)
01563      &  RESULT(E_IO)
01564         !--------------------------------------------------------------------------------------------------------------------------------
01565         !! FUNCTION FOR SAVING FIELD OF VECTORIAL VARIABLE (I4P).
01566         !--------------------------------------------------------------------------------------------------------------------------------
01567 
01568         IMPLICIT NONE
01569 
01570         !--------------------------------------------------------------------------------------------------------------------------------
01571         INTEGER(I4P), INTENT(IN):: NC_NN         ! NUMBER OF NODES OR CELLS
01572         CHARACTER(*), INTENT(IN):: VARNAME       ! VARIABLE NAME
01573         INTEGER(I4P), INTENT(IN):: VARX(1:NC_NN) ! X COMPONENT OF VECTOR
01574         INTEGER(I4P), INTENT(IN):: VARY(1:NC_NN) ! Y COMPONENT OF VECTOR
01575         INTEGER(I4P), INTENT(IN):: VARZ(1:NC_NN) ! Z COMPONENT OF VECTOR
01576         INTEGER(I4P)::             E_IO          ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01577         INTEGER(I8P)::             N1            ! COUNTER
01578         !--------------------------------------------------------------------------------------------------------------------------------
01579 
01580         !--------------------------------------------------------------------------------------------------------------------------------
01581         SELECT CASE(F_OUT)
01582         CASE(F_OUT_ASCII)
01583           WRITE(UNIT=UNIT_VTK,FMT='(A)',          IOSTAT=E_IO)
01584      &          'VECTORS '//TRIM(VARNAME)//' int'
01585           WRITE(UNIT=UNIT_VTK,FMT='(3'//FI4P//')',IOSTAT=E_IO)
01586      &          (VARX(N1),VARY(N1),VARZ(N1),N1=1,NC_NN)
01587         CASE(F_OUT_BINARY)
01588           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)'VECTORS '//TRIM(VARNAME)//
01589      &          ' int'//END_REC
01590           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)
01591      &          (VARX(N1),VARY(N1),VARZ(N1),N1=1,NC_NN)
01592           WRITE(UNIT=UNIT_VTK,IOSTAT=E_IO)END_REC
01593         ENDSELECT
01594         RETURN
01595         !--------------------------------------------------------------------------------------------------------------------------------
01596         END FUNCTION VTK_VAR_VECT_I4
01597 
01598         FUNCTION VTK_VAR_TEXT_R8(NC_NN,DIMM,VARNAME,TEXTCOO)
01599      &  RESULT(E_IO)
01600         !--------------------------------------------------------------------------------------------------------------------------------
01601         !! Function for saving texture variable (R8P).
01602         !--------------------------------------------------------------------------------------------------------------------------------
01603 
01604         IMPLICIT NONE
01605 
01606         !--------------------------------------------------------------------------------------------------------------------------------
01607         INTEGER(I4P), INTENT(IN):: NC_NN                   ! NUMBER OF NODES OR CELLS
01608         INTEGER(I4P), INTENT(IN):: DIMM                    ! TEXTURE DIMENSIONS
01609         CHARACTER(*), INTENT(IN):: VARNAME                 ! VARIABLE NAME
01610         REAL(R8P),    INTENT(IN):: TEXTCOO(1:NC_NN,1:DIMM) ! TEXTURE
01611         INTEGER(I4P)::             E_IO                    ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01612         CHARACTER(LEN=MAXLEN)::    S_BUFFER                ! BUFFER STRING
01613         CHARACTER(LEN=MAXLEN)::    S_BUFFER2               ! BUFFER STRING
01614         INTEGER(I8P)::             N1,N2                   ! COUNTERS
01615         !--------------------------------------------------------------------------------------------------------------------------------
01616 
01617         !--------------------------------------------------------------------------------------------------------------------------------
01618         SELECT CASE(F_OUT)
01619         CASE(F_OUT_ASCII)
01620           S_BUFFER2 = '(A,1X,'//FI4P//'1X,A)'
01621           WRITE(UNIT=UNIT_VTK,FMT=TRIM(S_BUFFER2),        IOSTAT=E_IO)
01622      &          'TEXTURE_COORDINATES '//TRIM(VARNAME),DIMM,' double'
01623           WRITE(S_BUFFER,     FMT='(I1)',                 IOSTAT=E_IO)
01624      &          DIMM
01625           S_BUFFER='('//TRIM(S_BUFFER)//FR4P//')'
01626           WRITE(UNIT=UNIT_VTK,FMT=TRIM(S_BUFFER),         IOSTAT=E_IO)
01627      &          ((TEXTCOO(N1,N2),N2=1,DIMM),N1=1,NC_NN)
01628         CASE(F_OUT_BINARY)
01629           S_BUFFER2 = '(A,1X,'//FI4P//'1X,A)'
01630           WRITE(S_BUFFER,     FMT=TRIM(S_BUFFER),         IOSTAT=E_IO)
01631      &          'TEXTURE_COORDINATES '//TRIM(VARNAME),DIMM,' double'
01632           WRITE(UNIT=UNIT_VTK,                            IOSTAT=E_IO)
01633      &          TRIM(S_BUFFER)//END_REC
01634           WRITE(UNIT=UNIT_VTK,                            IOSTAT=E_IO)
01635      &          ((TEXTCOO(N1,N2),N2=1,DIMM),N1=1,NC_NN)
01636           WRITE(UNIT=UNIT_VTK,                            IOSTAT=E_IO)
01637      &          END_REC
01638         ENDSELECT
01639         RETURN
01640         !--------------------------------------------------------------------------------------------------------------------------------
01641         END FUNCTION VTK_VAR_TEXT_R8
01642 
01643         FUNCTION VTK_VAR_TEXT_R4(NC_NN,DIMM,VARNAME,TEXTCOO)
01644      &  RESULT(E_IO)
01645         !--------------------------------------------------------------------------------------------------------------------------------
01646         !! FUNCTION FOR SAVING TEXTURE VARIABLE (R4P).
01647         !--------------------------------------------------------------------------------------------------------------------------------
01648 
01649         IMPLICIT NONE
01650 
01651         !--------------------------------------------------------------------------------------------------------------------------------
01652         INTEGER(I4P), INTENT(IN):: NC_NN                   ! NUMBER OF NODES OR CELLS
01653         INTEGER(I4P), INTENT(IN):: DIMM                    ! TEXTURE DIMENSIONS
01654         CHARACTER(*), INTENT(IN):: VARNAME                 ! VARIABLE NAME
01655         REAL(R4P),    INTENT(IN):: TEXTCOO(1:NC_NN,1:DIMM) ! TEXTURE
01656         INTEGER(I4P)::             E_IO                    ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01657         CHARACTER(LEN=MAXLEN)::    S_BUFFER                ! BUFFER STRING
01658         CHARACTER(LEN=MAXLEN)::    S_BUFFER2               ! BUFFER STRING
01659         INTEGER(I8P)::             N1,N2                   ! COUNTERS
01660         !--------------------------------------------------------------------------------------------------------------------------------
01661 
01662         !--------------------------------------------------------------------------------------------------------------------------------
01663         SELECT CASE(F_OUT)
01664         CASE(F_OUT_ASCII)
01665           S_BUFFER2 = '(A,1X,'//FI4P//'1X,A)'
01666           WRITE(UNIT=UNIT_VTK,FMT=TRIM(S_BUFFER2),        IOSTAT=E_IO)
01667      &          'TEXTURE_COORDINATES '//TRIM(VARNAME),DIMM,' float'
01668           WRITE(S_BUFFER,     FMT='(I1)',                 IOSTAT=E_IO)
01669      &          DIMM
01670           S_BUFFER='('//TRIM(S_BUFFER)//FR4P//')'
01671           WRITE(UNIT=UNIT_VTK,FMT=TRIM(S_BUFFER),         IOSTAT=E_IO)
01672      &          ((TEXTCOO(N1,N2),N2=1,DIMM),N1=1,NC_NN)
01673         CASE(F_OUT_BINARY)
01674           S_BUFFER2 = '(A,1X,'//FI4P//'1X,A)'
01675           WRITE(S_BUFFER,     FMT=TRIM(S_BUFFER2),        IOSTAT=E_IO)
01676      &          'TEXTURE_COORDINATES '//TRIM(VARNAME),DIMM,' float'
01677           WRITE(UNIT=UNIT_VTK,                            IOSTAT=E_IO)
01678      &          TRIM(S_BUFFER)//END_REC
01679           WRITE(UNIT=UNIT_VTK,                            IOSTAT=E_IO)
01680      &          ((TEXTCOO(N1,N2),N2=1,DIMM),N1=1,NC_NN)
01681           WRITE(UNIT=UNIT_VTK,                            IOSTAT=E_IO)
01682      &          END_REC
01683         ENDSELECT
01684         RETURN
01685         !--------------------------------------------------------------------------------------------------------------------------------
01686         END FUNCTION VTK_VAR_TEXT_R4
01687         !(DOC/)SKIPPEDBLOCK
01688 
01689         FUNCTION VTK_END() RESULT(E_IO)
01690         !--------------------------------------------------------------------------------------------------------------------------------
01691         !!THIS FUNCTION IS USED TO FINALIZE THE FILE OPENED AND IT HAS NOT INPUTS. THE \LIBVTKIO MANAGES THE FILE UNIT WITHOUT THE
01692         !!USER'S ACTION.
01693         !--------------------------------------------------------------------------------------------------------------------------------
01694 
01695         IMPLICIT NONE
01696 
01697         !--------------------------------------------------------------------------------------------------------------------------------
01698         INTEGER(I4P):: E_IO ! INPUT/OUTPUT INQUIRING FLAG: $0$ IF IO IS DONE, $> 0$ IF IO IS NOT DONE
01699         !!THE VTK\_END VARIABLES HAVE THE FOLLOWING MEANING:
01700         !!
01701         !!\BEGIN{DESCRIPTION}
01702         !! \ITEM[{\COLOR{ROYALBLUE}E\_IO}] CONTAINS THE INQUIRING INTEGER FLAG FOR ERROR HANDLING.
01703         !!\END{DESCRIPTION}
01704         !!
01705         !!THE FOLLOWING IS AN EXAMPLE OF VTK\_END CALLING:
01706         !!
01707         !!\BEGIN{BOXRED}{VTK\_END CALLING}
01708         !!\BEGIN{VERBATIM}
01709         !!...
01710         !!E_IO = VTK_END()
01711         !!...
01712         !!\END{VERBATIM}
01713         !!\END{BOXRED}
01714         !--------------------------------------------------------------------------------------------------------------------------------
01715 
01716         !--------------------------------------------------------------------------------------------------------------------------------
01717         CLOSE(UNIT=UNIT_VTK,IOSTAT=E_IO)
01718         RETURN
01719         !--------------------------------------------------------------------------------------------------------------------------------
01720         END FUNCTION VTK_END
01721 
01722         !!\chapter{VTK XML functions}
01723         !!\minitoc
01724         !!\vspace*{8mm}
01725         !!
01726         !!\lettrine[lines=2,loversize=-.1,lraise=0.2]{{\bf T}}{he} XML standard is more powerful than legacy one. It is more flexible
01727         !!and free but on the other hand is more (but not so more using a library like \LIBVTKIO...) complex than legacy standard. The
01728         !!output of XML functions is a well-formated XML file at least for the ascii format (in the binary format \LIBVTKIO use
01729         !!raw-data format that does not produce a well formated XML file).
01730         !!
01731         !!The XML functions follow the same calling-convention of the legacy functions; all the \LIBVTKIO XML functions are
01732         !!\MaiuscolettoBS{4-byte integer function}: the output of these functions is an integer that is $0$ if the function calling
01733         !!has been done right while it is $> 0$  if some errors occur. The functions calling is the same as legacy functions:
01734         !!
01735         !!\begin{boxred}{Functions Calling}
01736         !!\begin{verbatim}
01737         !!...
01738         !!integer(4):: E_IO
01739         !!...
01740         !!E_IO = VTK_INI_XML(....
01741         !!...
01742         !!\end{verbatim}
01743         !!\end{boxred}
01744         !!
01745         !!\noindent Note that the XML functions have the same name of legacy functions with the suffix \virgo{\_XML}.
01746         !!
01747 #endif
01748       END MODULE LIB_VTK_IO
01749       !!
01750       !!\appendix
01751       !!
01752       !!\chapter{LIB\_VTK\_IO Usage Example}
01753       !!\label{cap:example}
01754       !!\minitoc
01755       !!
01756       !!\vspace*{8mm}
01757       !!
01758       !!\lettrine[lines=2,loversize=-.1,lraise=0.2]{{\bf T}}{he} usage of \LIBVTKIO is quite simple. In this chapter there are some
01759       !!example of \LIBVTKIO usage. Some of the following examples are present also in the file \MaiuscolettoBS{Test\_LIB\_VTK\_IO.f90}
01760       !!distributed within the \LIBVTKIO.
01761       !!
01762       !!\section{Legacy Rectilinear Grid}
01763       !!\label{sec:example LRECTG}
01764       !!
01765       !!\begin{boxred}{Legacy Rectilinear Grid}
01766       !!\begin{verbatim}
01767       !!...
01768       !!integer(4), intent(IN)::   NX
01769       !!real(8),    intent(IN)::           p(1:NX)
01770       !!real(8),    intent(IN)::         rho(1:NX)
01771       !!real(8),    intent(IN)::           u(1:NX)
01772       !!real(8),    intent(IN)::       gamma(1:NX)
01773       !!character(*), intent(IN):: filename
01774       !!real(8)::                  x(1:NX)
01775       !!integer(4)::               i
01776       !!...
01777       !!x=(/(i, i=1, NX, 1)/)
01778       !!E_IO = VTK_INI(output_format = 'ascii',                &
01779       !!               filene        = trim(filename)//'.vtk', &
01780       !!               title         = 'Field',                &
01781       !!               mesh_topology = 'RECTILINEAR_GRID')
01782       !!E_IO = VTK_GEO(NX        = NX,        &
01783       !!               NY        = 1,         &
01784       !!               NZ        = 1,         &
01785       !!               X         = x,         &
01786       !!               Y         = (/0.0_8/), &
01787       !!               Z         = (/0.0_8/))
01788       !!E_IO = VTK_DAT(NC_NN   = NX,      &
01789       !!               tipo    = 'node')
01790       !!E_IO = VTK_VAR(NC_NN   = NX,      &
01791       !!               varname = 'p',     &
01792       !!               var     = p)
01793       !!E_IO = VTK_VAR(NC_NN   = NX,      &
01794       !!               varname = 'rho',   &
01795       !!               var     = rho)
01796       !!E_IO = VTK_VAR(NC_NN   = NX,      &
01797       !!               varname = 'u',     &
01798       !!               var     = u)
01799       !!E_IO = VTK_VAR(NC_NN   = NX,      &
01800       !!               varname = 'gamma', &
01801       !!               var     = gamma)
01802       !!E_IO = VTK_VAR(NC_NN   = NX,      &
01803       !!               varname = 'a',     &
01804       !!               var     = sqrt(gamma*p/rho))
01805       !!E_IO = VTK_END()
01806       !!...
01807       !!\end{verbatim}
01808       !!\end{boxred}
01809       !!
01810       !!\section{XML Rectilinear Grid}
01811       !!\label{sec:example XRECTG}
01812       !!
01813       !!\begin{boxred}{XML Rectilinear Grid}
01814       !!\begin{verbatim}
01815       !!...
01816       !!integer(4),   intent(IN):: n
01817       !!integer(4),   intent(IN):: NX
01818       !!real(8),      intent(IN)::     p(1:NX)
01819       !!real(8),      intent(IN)::   rho(1:NX)
01820       !!real(8),      intent(IN)::     u(1:NX)
01821       !!real(8),      intent(IN):: gamma(1:NX)
01822       !!character(*), intent(IN):: filename
01823       !!real(8)::                  x(1:NX)
01824       !!integer(4)::               i
01825       !!...
01826       !!x=(/(i, i=1, NX, 1)/)
01827       !!E_IO = VTK_INI_XML(output_format = 'ascii',                &
01828       !!                   filename      = trim(filename)//'.vtr', &
01829       !!                   mesh_topology = 'RectilinearGrid',      &
01830       !!                   nx1=1,nx2=NX,ny1=1,ny2=1,nz1=1,nz2=1)
01831       !!E_IO = VTK_GEO_XML(nx1=1,nx2=NX,ny1=1,ny2=1,nz1=1,nz2=1, &
01832       !!                   X=x,Y=(/0.0_8/),Z=(/0.0_8/))
01833       !!E_IO = VTK_DAT_XML(tipo    = 'node',   &
01834       !!                   azione  = 'OPEN')
01835       !!E_IO = VTK_VAR_XML(NC_NN   = NX,      &
01836       !!                   varname = 'p',     &
01837       !!                   var     = p)
01838       !!E_IO = VTK_VAR_XML(NC_NN   = NX,      &
01839       !!                   varname = 'rho',   &
01840       !!                   var     = rho)
01841       !!E_IO = VTK_VAR_XML(NC_NN   = NX,      &
01842       !!                   varname = 'u',     &
01843       !!                   var     = u)
01844       !!E_IO = VTK_VAR_XML(NC_NN   = NX,      &
01845       !!                   varname = 'gamma', &
01846       !!                   var     = gamma)
01847       !!E_IO = VTK_VAR_XML(NC_NN   = NX,      &
01848       !!                   varname = 'a',     &
01849       !!                   var     = sqrt(gamma*p/rho))
01850       !!E_IO = VTK_DAT_XML(tipo    = 'node',  &
01851       !!                   azione  = 'CLOSE')
01852       !!E_IO = VTK_GEO_XML()
01853       !!E_IO = VTK_END_XML()
01854       !!...
01855       !!\end{verbatim}
01856       !!\end{boxred}
01857       !!
01858       !!\section{Legacy Unstructured Grid}
01859       !!\label{sec:example LUNSTG}
01860       !!
01861       !!\begin{boxred}{Legacy Unstructured Grid}
01862       !!\begin{verbatim}
01863       !!...
01864       !!integer(4), parameter::       Nn   = 27
01865       !!integer(4), parameter::       Ne   = 11
01866       !!real(4),    dimension(1:Nn):: x_uns
01867       !!real(4),    dimension(1:Nn):: y_uns
01868       !!real(4),    dimension(1:Nn):: z_uns
01869       !!integer(4), dimension(1:Ne):: tipo
01870       !!integer(4), dimension(1:60):: connect
01871       !!real(8),    dimension(1:Nn):: var_uns_grid
01872       !!integer(4), dimension(1:Nn):: var_uns_grid_X
01873       !!integer(4), dimension(1:Nn):: var_uns_grid_Y
01874       !!integer(4), dimension(1:Nn):: var_uns_grid_Z
01875       !!...
01876       !!E_IO = VTK_INI(output_format  = 'BINARY',                   &
01877       !!               filename       = 'UNST_GRID_BIN.vtk',        &
01878       !!               title          = 'Unstructured Grid Example' &
01879       !!               mesh_topology  = 'UNSTRUCTURED_GRID')
01880       !!
01881       !!x_uns=(/0,1,2,0,1,2, &
01882       !!        0,1,2,0,1,2, &
01883       !!        0,1,2,0,1,2, &
01884       !!        0,1,2,0,1,2, &
01885       !!        0,1,2/)
01886       !!y_uns=(/0,0,0,1,1,1, &
01887       !!        0,0,0,1,1,1, &
01888       !!        1,1,1,1,1,1, &
01889       !!        1,1,1,1,1,1, &
01890       !!        1,1,1/)
01891       !!z_uns=(/0,0,0,0,0,0, &
01892       !!        1,1,1,1,1,1, &
01893       !!        2,2,2,3,3,3, &
01894       !!        4,4,4,5,5,5, &
01895       !!        6,6,6/)
01896       !!
01897       !!E_IO = VTK_GEO(Nnodi = Nn, &
01898       !!               X=x_uns,Y=y_uns,Z=z_uns)
01899       !!
01900       !!connect = (/ 8, 0, 1, 4, 3, 6, 7,10, 9, &
01901       !!             8, 1, 2, 5, 4, 7, 8,11,10, &
01902       !!             4, 6,10, 9,12,             &
01903       !!             4, 5,11,10,14,             &
01904       !!             6,15,16,17,14,13,12,       &
01905       !!             6,18,15,19,16,20,17,       &
01906       !!             4,22,23,20,19,             &
01907       !!             3,21,22,18,                &
01908       !!             3,22,19,18,                &
01909       !!             2,26,25,                   &
01910       !!             1,24/)
01911       !!tipo = (/12, &
01912       !!         12, &
01913       !!         10, &
01914       !!         10, &
01915       !!          7, &
01916       !!          6, &
01917       !!          9, &
01918       !!          5, &
01919       !!          5, &
01920       !!          3, &
01921       !!          1/)
01922       !!E_IO = VTK_CON(NCelle  = Ne,       &
01923       !!               connect = connect,  &
01924       !!               tipo    = tipo)
01925       !!E_IO = VTK_DAT(NC_NN   = Nn,       &
01926       !!               tipo    = 'node')
01927       !!
01928       !!var_uns_grid =(/ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, &
01929       !!                 6.0, 7.0, 8.0, 9.0,10.0,11.0, &
01930       !!                12.0,13.0,14.0,15.0,16.0,17.0, &
01931       !!                18.0,19.0,20.0,21.0,22.0,23.0, &
01932       !!                24.0,25.0,26.0/)
01933       !!
01934       !!E_IO = VTK_VAR(NC_NN   = Nn,        &
01935       !!               varname = 'scalars', &
01936       !!               var     = var_uns_grid)
01937       !!
01938       !!var_uns_grid_X=(/1,1,0,1,1,0, &
01939       !!                 1,1,0,1,1,0, &
01940       !!                 0,0,0,0,0,0, &
01941       !!                 0,0,0,0,0,0, &
01942       !!                 0,0,0/)
01943       !!var_uns_grid_Y=(/0,1,2,0,1,2, &
01944       !!                 0,1,2,0,1,2, &
01945       !!                 0,0,0,0,0,0, &
01946       !!                 0,0,0,0,0,0, &
01947       !!                 0,0,0/)
01948       !!var_uns_grid_Z=(/0,0,0,0,0,0, &
01949       !!                 0,0,0,0,0,0, &
01950       !!                 1,1,1,1,1,1, &
01951       !!                 1,1,1,1,1,1, &
01952       !!                 1,1,1/)
01953       !!E_IO = VTK_VAR(NC_NN   = Nn,             &
01954       !!               varname = 'vectors',      &
01955       !!               varX    = var_uns_grid_X, &
01956       !!               varY    = var_uns_grid_Y, &
01957       !!               varZ    = var_uns_grid_Z)
01958       !!E_IO = VTK_END()
01959       !!...
01960       !!\end{verbatim}
01961       !!\end{boxred}
01962       !!
01963       !!\section{XML Unstructured Grid}
01964       !!\label{sec:example XUNSTG}
01965       !!
01966       !!\begin{boxred}{XML Unstructured Grid}
01967       !!\begin{verbatim}
01968       !!...
01969       !!integer(4), parameter::       Nn   = 27
01970       !!integer(4), parameter::       Ne   = 11
01971       !!real(4),    dimension(1:Nn):: x_uns
01972       !!real(4),    dimension(1:Nn):: y_uns
01973       !!real(4),    dimension(1:Nn):: z_uns
01974       !!integer(4), dimension(1:Ne):: tipo
01975       !!integer(4), dimension(1:49):: connect_xml
01976       !!integer(4), dimension(1:Ne):: offset_xml
01977       !!real(8),    dimension(1:Nn):: var_uns_grid
01978       !!integer(4), dimension(1:Nn):: var_uns_grid_X
01979       !!integer(4), dimension(1:Nn):: var_uns_grid_Y
01980       !!integer(4), dimension(1:Nn):: var_uns_grid_Z
01981       !!...
01982       !!E_IO = VTK_INI_XML(output_format = 'BINARY',              &
01983       !!                   filename      = 'XML_UNST_BINARY.vtu', &
01984       !!                   mesh_topology = 'UnstructuredGrid')
01985       !!
01986       !!x_uns=(/0,1,2,0,1,2, &
01987       !!        0,1,2,0,1,2, &
01988       !!        0,1,2,0,1,2, &
01989       !!        0,1,2,0,1,2, &
01990       !!        0,1,2/)
01991       !!y_uns=(/0,0,0,1,1,1, &
01992       !!        0,0,0,1,1,1, &
01993       !!        1,1,1,1,1,1, &
01994       !!        1,1,1,1,1,1, &
01995       !!        1,1,1/)
01996       !!z_uns=(/0,0,0,0,0,0, &
01997       !!        1,1,1,1,1,1, &
01998       !!        2,2,2,3,3,3, &
01999       !!        4,4,4,5,5,5, &
02000       !!        6,6,6/)
02001       !!
02002       !!E_IO = VTK_GEO_XML(Nnodi     = Nn, &
02003       !!                   NCelle    = Ne, &
02004       !!                   X=x_uns,Y=y_uns,Z=z_uns)
02005       !!
02006       !!connect_xml = (/ 0, 1, 4, 3, 6, 7,10, 9, &
02007       !!                 1, 2, 5, 4, 7, 8,11,10, &
02008       !!                 6,10, 9,12,             &
02009       !!                 5,11,10,14,             &
02010       !!                15,16,17,14,13,12,       &
02011       !!                18,15,19,16,20,17,       &
02012       !!                22,23,20,19,             &
02013       !!                21,22,18,                &
02014       !!                22,19,18,                &
02015       !!                26,25,                   &
02016       !!                24/)
02017       !!offset_xml = (/ 8, &
02018       !!               16, &
02019       !!               20, &
02020       !!               24, &
02021       !!               30, &
02022       !!               36, &
02023       !!               40, &
02024       !!               43, &
02025       !!               46, &
02026       !!               48, &
02027       !!               49/)
02028       !!
02029       !!E_IO = VTK_CON_XML(NCelle  = Ne,          &
02030       !!                   connect = connect_xml, &
02031       !!                   offset  = offset_xml,  &
02032       !!                   tipo    = (/12_1, &
02033       !!                               12_1, &
02034       !!                               10_1, &
02035       !!                               10_1, &
02036       !!                                7_1, &
02037       !!                                6_1, &
02038       !!                                9_1, &
02039       !!                                5_1, &
02040       !!                                5_1, &
02041       !!                                3_1, &
02042       !!                                1_1/))
02043       !!
02044       !!E_IO = VTK_DAT_XML(tipo    = 'node', &
02045       !!                   azione  = 'OPEN')
02046       !!
02047       !!var_uns_grid =(/ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, &
02048       !!                 6.0, 7.0, 8.0, 9.0,10.0,11.0, &
02049       !!                12.0,13.0,14.0,15.0,16.0,17.0, &
02050       !!                18.0,19.0,20.0,21.0,22.0,23.0, &
02051       !!                24.0,25.0,26.0/)
02052       !!
02053       !!E_IO = VTK_VAR_XML(NC_NN   = Nn,        &
02054       !!                   varname = 'scalars', &
02055       !!                   var     = var_uns_grid)
02056       !!
02057       !!var_uns_grid_X=(/1,1,0,1,1,0, &
02058       !!                 1,1,0,1,1,0, &
02059       !!                 0,0,0,0,0,0, &
02060       !!                 0,0,0,0,0,0, &
02061       !!                 0,0,0/)
02062       !!var_uns_grid_Y=(/0,1,2,0,1,2, &
02063       !!                 0,1,2,0,1,2, &
02064       !!                 0,0,0,0,0,0, &
02065       !!                 0,0,0,0,0,0, &
02066       !!                 0,0,0/)
02067       !!var_uns_grid_Z=(/0,0,0,0,0,0, &
02068       !!                 0,0,0,0,0,0, &
02069       !!                 1,1,1,1,1,1, &
02070       !!                 1,1,1,1,1,1, &
02071       !!                 1,1,1/)
02072       !!
02073       !!E_IO = VTK_VAR_XML(NC_NN   = Nn,             &
02074       !!                   varname = 'vector',       &
02075       !!                   varX    = var_uns_grid_X, &
02076       !!                   varY    = var_uns_grid_Y, &
02077       !!                   varZ    = var_uns_grid_Z)
02078       !!E_IO = VTK_DAT_XML(tipo    = 'node',   &
02079       !!                   azione  = 'CLOSE')
02080       !!E_IO = VTK_GEO_XML()
02081       !!E_IO = VTK_END_XML()
02082       !!...
02083       !!\end{verbatim}
02084       !!\end{boxred}
02085       !!
02086       !!\chapter{Fortran \& Portable-Kind-Precision Selection}
02087       !!\label{cap:kind precision}
02088       !!
02089       !!\lettrine[lines=2,loversize=-.1,lraise=0.2]{{\bf F}}{ortran} is the most popular programming language for scientific computing.
02090       !!With fortran it is quite simple obtain fast code and manage large multidimensional array. Because fortran permits the achivment
02091       !!of high performance it is also used on great range of different computer-architettures, and often on the fastest supercomputer
02092       !!in the world. Therefore fortran programs must be \MaiuscolettoBS{portable}: portability means that the code will give the same
02093       !!results on every different computer-architettures. One of the most important goal of the numeric code is to control the
02094       !!\MaiuscolettoBS{the numeric error} due to finite precision of numerical operations. Fortran uses the \MaiuscolettoBS{IEEE
02095       !!rappresentations}; integers and reals (floating point) are represented with a finite precision. So when the code computes an
02096       !!operation it has a \MaiuscolettoBS{trunction error} due to the truncation of the numerical finite rappresentaions. For numerical
02097       !!and more in general scientific applications this source of errors must be controlled. The programmer must know which is the
02098       !!precision associated to the code variables. Before the standard fortran 90/95 there are not any way to select the precision of
02099       !!the numerical variables in a portable fashion. With the possibility to specify a kind parameter for variables, the standard
02100       !!fortran 90/95 makes avaible two useful functions to select the kind precision of integers and reals:
02101       !!
02102       !!\begin{boxred}{selected\_real\_kind \& selected\_int\_kind}
02103       !!\begin{verbatim}
02104       !!function selected_real_kind(p,r) result(kind_id)
02105       !!integer, intent(IN), optional:: p
02106       !!integer, intent(IN), optional:: r
02107       !!integer::                       kind_id
02108       !!
02109       !!The result, kind_id, is a scalar of type default integer.
02110       !!If both arguments are absent, the result is zero.
02111       !!Otherwise, the result has a value equal to a value of
02112       !!the kind parameter of a real data type with decimal
02113       !!precision, as returned by the function PRECISION, of at
02114       !!least p digits and a decimal exponent range, as returned
02115       !!by the function RANGE, of at least r.
02116       !!
02117       !!function selected_int_kind(p) result(kind_id)
02118       !!integer, intent(IN), optional:: p
02119       !!integer::                       kind_id
02120       !!
02121       !!The result, kind_id, is a scalar of type default integer.
02122       !!The result has a value equal to the value of the kind
02123       !!parameter of the integer data type that represents all
02124       !!values n in the range of about values n with
02125       !!-10^p < n < 10^p.
02126       !!\end{verbatim}
02127       !!\end{boxred}
02128       !!
02129       !!Using these two functions the programmer can accurately control the precision of its own variables in a portable manner.
02130       !!Note that specifing the kind precision without using these two functions is not portable: $real(8)$ means different
02131       !!precisions on different architettures. Parametrizing the kind of all numerical variables using these two functions makes
02132       !!the portable. The \LIBVTKIO uses this principle to achive portable-kind-precision selection; in the library are defined
02133       !!some parameters by which all variables kind-precisions are parametrized:
02134       !!
02135       !!\begin{boxblu}{\LIBVTKIO Kind-Precision Parameters}
02136       !!{\color{RoyalBlue}\MaiuscolettoS{Real Precision Definitions}}
02137       !!\begin{description}
02138       !! \item [{\color{RoyalBlue}R16P}] real with $33$ digits, range $[+-10^{-4931},+-10^{+4931}-1]$
02139       !! \item [{\color{RoyalBlue}R8P}]  real with $15$ digits, range $[+-10^{-307} ,+-10^{+307}-1 ]$
02140       !! \item [{\color{RoyalBlue}R4P}]  real with $6$  digits, range $[+-10^{-37}  ,+-10^+{37}-1  ]$
02141       !!\end{description}
02142       !!{\color{RoyalBlue}\MaiuscolettoS{Integer Precision Definitions}}
02143       !!\begin{description}
02144       !! \item [{\color{RoyalBlue}I8P}] range $[-2^{63},+2^{63}-1]$
02145       !! \item [{\color{RoyalBlue}I4P}] range $[-2^{31},+2^{31}-1]$
02146       !! \item [{\color{RoyalBlue}I2P}] range $[-2^{15},+2^{15}-1]$
02147       !! \item [{\color{RoyalBlue}I1P}] range $[-2^{7} ,+2^{7} -1]$
02148       !!\end{description}
02149       !!\end{boxblu}
02150       !!
02151       !!In order to avoid strange results porting your code the use of parametrized-kind-precision is very useful. The \LIBVTKIO
02152       !!makes avaible to the external its own kind-parameters that can be used to parametrize the code.
02153       !!
02154       !!\chapter{Dynamic Dispatching}
02155       !!\label{cap:Dynamic Dispatching}
02156       !!
02157       !!\lettrine[lines=2,loversize=-.1,lraise=0.2]{{\bf F}}{ortran} is not an \MaiuscolettoBS{object oriented} (OOp) programming
02158       !!language. It is a procedural language with some of the the goals (ineritance, user-definited data type, polimorphism...)
02159       !!of OOp. Fortran most important aim is to ensure the performance of the code not its \virgo{friendliness}... Despite its
02160       !!nature, fortran 90/95 makes avaible some interesting features: it permits the dynamic dispatching of functions and
02161       !!subroutine ensuring the best performance. This goal is achived with use of $interface$ construct. In the \LIBVTKIO there are,
02162       !!at today, 4 interface blocks:
02163       !!
02164       !!\begin{boxred}{\LIBVTKIO Interface Blocks}
02165       !!\begin{verbatim}
02166       !!interface VTK_GEO
02167       !!  module procedure VTK_GEO_UNST_R8, &
02168       !!                   VTK_GEO_UNST_R4, &
02169       !!                   VTK_GEO_STRP_R8, &
02170       !!                   VTK_GEO_STRP_R4, &
02171       !!                   VTK_GEO_STRG_R8, &
02172       !!                   VTK_GEO_STRG_R4, &
02173       !!                   VTK_GEO_RECT_R8, &
02174       !!                   VTK_GEO_RECT_R4
02175       !!endinterface
02176       !!
02177       !!interface VTK_VAR
02178       !!  module procedure VTK_VAR_SCAL_R8, &
02179       !!                   VTK_VAR_SCAL_R4, &
02180       !!                   VTK_VAR_SCAL_I4, &
02181       !!                   VTK_VAR_VECT_R8, &
02182       !!                   VTK_VAR_VECT_R4, &
02183       !!                   VTK_VAR_VECT_I4, &
02184       !!                   VTK_VAR_TEXT_R8, &
02185       !!                   VTK_VAR_TEXT_R4
02186       !!endinterface
02187       !!
02188       !!interface VTK_GEO_XML
02189       !!  module procedure VTK_GEO_XML_STRG_R4, &
02190       !!                   VTK_GEO_XML_STRG_R8, &
02191       !!                   VTK_GEO_XML_RECT_R8, &
02192       !!                   VTK_GEO_XML_RECT_R4, &
02193       !!                   VTK_GEO_XML_UNST_R8, &
02194       !!                   VTK_GEO_XML_UNST_R4, &
02195       !!                   VTK_GEO_XML_CLOSEP
02196       !!endinterface
02197       !!
02198       !!interface VTK_VAR_XML
02199       !!  module procedure VTK_VAR_XML_SCAL_R8, &
02200       !!                   VTK_VAR_XML_SCAL_R4, &
02201       !!                   VTK_VAR_XML_SCAL_I8, &
02202       !!                   VTK_VAR_XML_SCAL_I4, &
02203       !!                   VTK_VAR_XML_SCAL_I2, &
02204       !!                   VTK_VAR_XML_SCAL_I1, &
02205       !!                   VTK_VAR_XML_VECT_R8, &
02206       !!                   VTK_VAR_XML_VECT_R4, &
02207       !!                   VTK_VAR_XML_VECT_I8, &
02208       !!                   VTK_VAR_XML_VECT_I4, &
02209       !!                   VTK_VAR_XML_VECT_I2, &
02210       !!                   VTK_VAR_XML_VECT_I1
02211       !!endinterface
02212       !!\end{verbatim}
02213       !!\end{boxred}
02214       !!
02215       !!By the interface construct \LIBVTKIO has a more simple API. The user deals with a few functions without non-sense-long-name...
02216       !!Dynamic dispatching is not the magic wand to solve all problems but it is an useful tool to simplify the code API. It is
02217       !!not powerful as the C++ template, but it is a \MaiuscolettoBS{quantum-leap} for fortran programmers.
02218       !!
02219       !!\chapter{Known Bugs}
02220       !!\label{cap:BUG}
02221       !!
02222       !!\lettrine[lines=2,loversize=-.1,lraise=0.2]{{\bf T}}{he} \LIBVTKIO is a very young project and it is a good example of wrong
02223       !!programming style... It is unstable and not tested. It is used by only one user (... me of course!) and there are a lot of
02224       !!bugs that are still hidden. At the moment several features are missing (the input functions and the poly-data topology...),
02225       !!but it is useful to export fortran data to VTK standard, and this goal was the most important for me.
02226       !!
02227       !!At today only one main bug was found. Fortran allows the automatic reshape of arrays: as an example 2D array can be
02228       !!automatically (in the function calling) transformed  to a 1D array with the same number of element of 2D array. The use of
02229       !!dynamic dispatching had disable this feature: dynamic dispatching use the array-shape information to dectet, at compile-time,
02230       !!the correct function to be called. So reshape arrays at calling phase is not allowed. In the next release I will fix this bug
02231       !!introducing the function to reshape arrays between 1D, 2D and 3D arrays.
02232       !!
02233       !!A possible, not already found, bug is the non correct kind detection. It is possible that a code uses kind-precision parameter
02234       !!that does not match the \LIBVTKIO parameters. I never observe this bug but it is possible. To avoid it the simple way is to use
02235       !!always the \LIBVTKIO kind-precision parameters; if the parameters actually present do not match your necessities, define new
02236       !!parameters in \LIBVTKIO and redistribuite \LIBVTKIO with your pacth!
02237       !!
02238       !!Finally there is a strong inefficiency when saving XML binary file. To write XML binary \LIBVTKIO uses a temporary scratch file
02239       !!to save binary data while saving all formatting data to the final XML file; only when all XML formatting data have been written
02240       !!the scratch file is rewinded and the binary data is saved in the final tag of XML file as \MaiuscolettoBS{raw} data. This
02241       !!algorithm is obviously inefficient. Any tip is welcome!
02242       !!
02243       !!\chapter{GNU GENERAL PUBLIC LICENSE}
02244       !!\label{cap:GPL}
02245       !!
02246       !!\begin{center}
02247       !!\MaiuscolettoS{Version 3, 29 June 2007}
02248       !!
02249       !!{\parindent 0in
02250       !!
02251       !!Copyright \copyright\ 2007 Free Software Foundation, Inc. \texttt{http://fsf.org/}
02252       !!
02253       !!\bigskip
02254       !!Everyone is permitted to copy and distribute verbatim copies of this
02255       !!
02256       !!license document, but changing it is not allowed.}
02257       !!
02258       !!\end{center}
02259       !!
02260       !!
02261       !!\section*{Preamble}
02262       !!The GNU General Public License is a free, copyleft license for
02263       !!software and other kinds of works.
02264       !!
02265       !!The licenses for most software and other practical works are designed
02266       !!to take away your freedom to share and change the works.  By contrast,
02267       !!the GNU General Public License is intended to guarantee your freedom to
02268       !!share and change all versions of a program--to make sure it remains free
02269       !!software for all its users.  We, the Free Software Foundation, use the
02270       !!GNU General Public License for most of our software; it applies also to
02271       !!any other work released this way by its authors.  You can apply it to
02272       !!your programs, too.
02273       !!
02274       !!When we speak of free software, we are referring to freedom, not
02275       !!price.  Our General Public Licenses are designed to make sure that you
02276       !!have the freedom to distribute copies of free software (and charge for
02277       !!them if you wish), that you receive source code or can get it if you
02278       !!want it, that you can change the software or use pieces of it in new
02279       !!free programs, and that you know you can do these things.
02280       !!
02281       !!To protect your rights, we need to prevent others from denying you
02282       !!these rights or asking you to surrender the rights.  Therefore, you have
02283       !!certain responsibilities if you distribute copies of the software, or if
02284       !!you modify it: responsibilities to respect the freedom of others.
02285       !!
02286       !!For example, if you distribute copies of such a program, whether
02287       !!gratis or for a fee, you must pass on to the recipients the same
02288       !!freedoms that you received.  You must make sure that they, too, receive
02289       !!or can get the source code.  And you must show them these terms so they
02290       !!know their rights.
02291       !!
02292       !!Developers that use the GNU GPL protect your rights with two steps:
02293       !!(1) assert copyright on the software, and (2) offer you this License
02294       !!giving you legal permission to copy, distribute and/or modify it.
02295       !!
02296       !!For the developers' and authors' protection, the GPL clearly explains
02297       !!that there is no warranty for this free software.  For both users' and
02298       !!authors' sake, the GPL requires that modified versions be marked as
02299       !!changed, so that their problems will not be attributed erroneously to
02300       !!authors of previous versions.
02301       !!
02302       !!Some devices are designed to deny users access to install or run
02303       !!modified versions of the software inside them, although the manufacturer
02304       !!can do so.  This is fundamentally incompatible with the aim of
02305       !!protecting users' freedom to change the software.  The systematic
02306       !!pattern of such abuse occurs in the area of products for individuals to
02307       !!use, which is precisely where it is most unacceptable.  Therefore, we
02308       !!have designed this version of the GPL to prohibit the practice for those
02309       !!products.  If such problems arise substantially in other domains, we
02310       !!stand ready to extend this provision to those domains in future versions
02311       !!of the GPL, as needed to protect the freedom of users.
02312       !!
02313       !!Finally, every program is threatened constantly by software patents.
02314       !!States should not allow patents to restrict development and use of
02315       !!software on general-purpose computers, but in those that do, we wish to
02316       !!avoid the special danger that patents applied to a free program could
02317       !!make it effectively proprietary.  To prevent this, the GPL assures that
02318       !!patents cannot be used to render the program non-free.
02319       !!
02320       !!The precise terms and conditions for copying, distribution and
02321       !!modification follow.
02322       !!
02323       !!
02324       !!\begin{center}
02325       !!{\Large \sc Terms and Conditions}
02326       !!\end{center}
02327       !!
02328       !!\begin{enumerate}
02329       !!
02330       !!\addtocounter{enumi}{-1}
02331       !!
02332       !!\item Definitions.
02333       !!
02334       !!``This License'' refers to version 3 of the GNU General Public License.
02335       !!
02336       !!``Copyright'' also means copyright-like laws that apply to other kinds of
02337       !!works, such as semiconductor masks.
02338       !!
02339       !!``The Program'' refers to any copyrightable work licensed under this
02340       !!License.  Each licensee is addressed as ``you''.  ``Licensees'' and
02341       !!``recipients'' may be individuals or organizations.
02342       !!
02343       !!To ``modify'' a work means to copy from or adapt all or part of the work
02344       !!in a fashion requiring copyright permission, other than the making of an
02345       !!exact copy.  The resulting work is called a ``modified version'' of the
02346       !!earlier work or a work ``based on'' the earlier work.
02347       !!
02348       !!A ``covered work'' means either the unmodified Program or a work based
02349       !!on the Program.
02350       !!
02351       !!To ``propagate'' a work means to do anything with it that, without
02352       !!permission, would make you directly or secondarily liable for
02353       !!infringement under applicable copyright law, except executing it on a
02354       !!computer or modifying a private copy.  Propagation includes copying,
02355       !!distribution (with or without modification), making available to the
02356       !!public, and in some countries other activities as well.
02357       !!
02358       !!To ``convey'' a work means any kind of propagation that enables other
02359       !!parties to make or receive copies.  Mere interaction with a user through
02360       !!a computer network, with no transfer of a copy, is not conveying.
02361       !!
02362       !!An interactive user interface displays ``Appropriate Legal Notices''
02363       !!to the extent that it includes a convenient and prominently visible
02364       !!feature that (1) displays an appropriate copyright notice, and (2)
02365       !!tells the user that there is no warranty for the work (except to the
02366       !!extent that warranties are provided), that licensees may convey the
02367       !!work under this License, and how to view a copy of this License.  If
02368       !!the interface presents a list of user commands or options, such as a
02369       !!menu, a prominent item in the list meets this criterion.
02370       !!
02371       !!\item Source Code.
02372       !!
02373       !!The ``source code'' for a work means the preferred form of the work
02374       !!for making modifications to it.  ``Object code'' means any non-source
02375       !!form of a work.
02376       !!
02377       !!A ``Standard Interface'' means an interface that either is an official
02378       !!standard defined by a recognized standards body, or, in the case of
02379       !!interfaces specified for a particular programming language, one that
02380       !!is widely used among developers working in that language.
02381       !!
02382       !!The ``System Libraries'' of an executable work include anything, other
02383       !!than the work as a whole, that (a) is included in the normal form of
02384       !!packaging a Major Component, but which is not part of that Major
02385       !!Component, and (b) serves only to enable use of the work with that
02386       !!Major Component, or to implement a Standard Interface for which an
02387       !!implementation is available to the public in source code form.  A
02388       !!``Major Component'', in this context, means a major essential component
02389       !!(kernel, window system, and so on) of the specific operating system
02390       !!(if any) on which the executable work runs, or a compiler used to
02391       !!produce the work, or an object code interpreter used to run it.
02392       !!
02393       !!The ``Corresponding Source'' for a work in object code form means all
02394       !!the source code needed to generate, install, and (for an executable
02395       !!work) run the object code and to modify the work, including scripts to
02396       !!control those activities.  However, it does not include the work's
02397       !!System Libraries, or general-purpose tools or generally available free
02398       !!programs which are used unmodified in performing those activities but
02399       !!which are not part of the work.  For example, Corresponding Source
02400       !!includes interface definition files associated with source files for
02401       !!the work, and the source code for shared libraries and dynamically
02402       !!linked subprograms that the work is specifically designed to require,
02403       !!such as by intimate data communication or control flow between those
02404       !!subprograms and other parts of the work.
02405       !!
02406       !!The Corresponding Source need not include anything that users
02407       !!can regenerate automatically from other parts of the Corresponding
02408       !!Source.
02409       !!
02410       !!The Corresponding Source for a work in source code form is that
02411       !!same work.
02412       !!
02413       !!\item Basic Permissions.
02414       !!
02415       !!All rights granted under this License are granted for the term of
02416       !!copyright on the Program, and are irrevocable provided the stated
02417       !!conditions are met.  This License explicitly affirms your unlimited
02418       !!permission to run the unmodified Program.  The output from running a
02419       !!covered work is covered by this License only if the output, given its
02420       !!content, constitutes a covered work.  This License acknowledges your
02421       !!rights of fair use or other equivalent, as provided by copyright law.
02422       !!
02423       !!You may make, run and propagate covered works that you do not
02424       !!convey, without conditions so long as your license otherwise remains
02425       !!in force.  You may convey covered works to others for the sole purpose
02426       !!of having them make modifications exclusively for you, or provide you
02427       !!with facilities for running those works, provided that you comply with
02428       !!the terms of this License in conveying all material for which you do
02429       !!not control copyright.  Those thus making or running the covered works
02430       !!for you must do so exclusively on your behalf, under your direction
02431       !!and control, on terms that prohibit them from making any copies of
02432       !!your copyrighted material outside their relationship with you.
02433       !!
02434       !!Conveying under any other circumstances is permitted solely under
02435       !!the conditions stated below.  Sublicensing is not allowed; section 10
02436       !!makes it unnecessary.
02437       !!
02438       !!\item Protecting Users' Legal Rights From Anti-Circumvention Law.
02439       !!
02440       !!No covered work shall be deemed part of an effective technological
02441       !!measure under any applicable law fulfilling obligations under article
02442       !!11 of the WIPO copyright treaty adopted on 20 December 1996, or
02443       !!similar laws prohibiting or restricting circumvention of such
02444       !!measures.
02445       !!
02446       !!When you convey a covered work, you waive any legal power to forbid
02447       !!circumvention of technological measures to the extent such circumvention
02448       !!is effected by exercising rights under this License with respect to
02449       !!the covered work, and you disclaim any intention to limit operation or
02450       !!modification of the work as a means of enforcing, against the work's
02451       !!users, your or third parties' legal rights to forbid circumvention of
02452       !!technological measures.
02453       !!
02454       !!\item Conveying Verbatim Copies.
02455       !!
02456       !!You may convey verbatim copies of the Program's source code as you
02457       !!receive it, in any medium, provided that you conspicuously and
02458       !!appropriately publish on each copy an appropriate copyright notice;
02459       !!keep intact all notices stating that this License and any
02460       !!non-permissive terms added in accord with section 7 apply to the code;
02461       !!keep intact all notices of the absence of any warranty; and give all
02462       !!recipients a copy of this License along with the Program.
02463       !!
02464       !!You may charge any price or no price for each copy that you convey,
02465       !!and you may offer support or warranty protection for a fee.
02466       !!
02467       !!\item Conveying Modified Source Versions.
02468       !!
02469       !!You may convey a work based on the Program, or the modifications to
02470       !!produce it from the Program, in the form of source code under the
02471       !!terms of section 4, provided that you also meet all of these conditions:
02472       !!  \begin{enumerate}
02473       !!  \item The work must carry prominent notices stating that you modified
02474       !!  it, and giving a relevant date.
02475       !!
02476       !!  \item The work must carry prominent notices stating that it is
02477       !!  released under this License and any conditions added under section
02478       !!  7.  This requirement modifies the requirement in section 4 to
02479       !!  ``keep intact all notices''.
02480       !!
02481       !!  \item You must license the entire work, as a whole, under this
02482       !!  License to anyone who comes into possession of a copy.  This
02483       !!  License will therefore apply, along with any applicable section 7
02484       !!  additional terms, to the whole of the work, and all its parts,
02485       !!  regardless of how they are packaged.  This License gives no
02486       !!  permission to license the work in any other way, but it does not
02487       !!  invalidate such permission if you have separately received it.
02488       !!
02489       !!  \item If the work has interactive user interfaces, each must display
02490       !!  Appropriate Legal Notices; however, if the Program has interactive
02491       !!  interfaces that do not display Appropriate Legal Notices, your
02492       !!  work need not make them do so.
02493       !!\end{enumerate}
02494       !!A compilation of a covered work with other separate and independent
02495       !!works, which are not by their nature extensions of the covered work,
02496       !!and which are not combined with it such as to form a larger program,
02497       !!in or on a volume of a storage or distribution medium, is called an
02498       !!``aggregate'' if the compilation and its resulting copyright are not
02499       !!used to limit the access or legal rights of the compilation's users
02500       !!beyond what the individual works permit.  Inclusion of a covered work
02501       !!in an aggregate does not cause this License to apply to the other
02502       !!parts of the aggregate.
02503       !!
02504       !!\item Conveying Non-Source Forms.
02505       !!
02506       !!You may convey a covered work in object code form under the terms
02507       !!of sections 4 and 5, provided that you also convey the
02508       !!machine-readable Corresponding Source under the terms of this License,
02509       !!in one of these ways:
02510       !!  \begin{enumerate}
02511       !!  \item Convey the object code in, or embodied in, a physical product
02512       !!  (including a physical distribution medium), accompanied by the
02513       !!  Corresponding Source fixed on a durable physical medium
02514       !!  customarily used for software interchange.
02515       !!
02516       !!  \item Convey the object code in, or embodied in, a physical product
02517       !!  (including a physical distribution medium), accompanied by a
02518       !!  written offer, valid for at least three years and valid for as
02519       !!  long as you offer spare parts or customer support for that product
02520       !!  model, to give anyone who possesses the object code either (1) a
02521       !!  copy of the Corresponding Source for all the software in the
02522       !!  product that is covered by this License, on a durable physical
02523       !!  medium customarily used for software interchange, for a price no
02524       !!  more than your reasonable cost of physically performing this
02525       !!  conveying of source, or (2) access to copy the
02526       !!  Corresponding Source from a network server at no charge.
02527       !!
02528       !!  \item Convey individual copies of the object code with a copy of the
02529       !!  written offer to provide the Corresponding Source.  This
02530       !!  alternative is allowed only occasionally and noncommercially, and
02531       !!  only if you received the object code with such an offer, in accord
02532       !!  with subsection 6b.
02533       !!
02534       !!  \item Convey the object code by offering access from a designated
02535       !!  place (gratis or for a charge), and offer equivalent access to the
02536       !!  Corresponding Source in the same way through the same place at no
02537       !!  further charge.  You need not require recipients to copy the
02538       !!  Corresponding Source along with the object code.  If the place to
02539       !!  copy the object code is a network server, the Corresponding Source
02540       !!  may be on a different server (operated by you or a third party)
02541       !!  that supports equivalent copying facilities, provided you maintain
02542       !!  clear directions next to the object code saying where to find the
02543       !!  Corresponding Source.  Regardless of what server hosts the
02544       !!  Corresponding Source, you remain obligated to ensure that it is
02545       !!  available for as long as needed to satisfy these requirements.
02546       !!
02547       !!  \item Convey the object code using peer-to-peer transmission, provided
02548       !!  you inform other peers where the object code and Corresponding
02549       !!  Source of the work are being offered to the general public at no
02550       !!  charge under subsection 6d.
02551       !!  \end{enumerate}
02552       !!
02553       !!A separable portion of the object code, whose source code is excluded
02554       !!from the Corresponding Source as a System Library, need not be
02555       !!included in conveying the object code work.
02556       !!
02557       !!A ``User Product'' is either (1) a ``consumer product'', which means any
02558       !!tangible personal property which is normally used for personal, family,
02559       !!or household purposes, or (2) anything designed or sold for incorporation
02560       !!into a dwelling.  In determining whether a product is a consumer product,
02561       !!doubtful cases shall be resolved in favor of coverage.  For a particular
02562       !!product received by a particular user, ``normally used'' refers to a
02563       !!typical or common use of that class of product, regardless of the status
02564       !!of the particular user or of the way in which the particular user
02565       !!actually uses, or expects or is expected to use, the product.  A product
02566       !!is a consumer product regardless of whether the product has substantial
02567       !!commercial, industrial or non-consumer uses, unless such uses represent
02568       !!the only significant mode of use of the product.
02569       !!
02570       !!``Installation Information'' for a User Product means any methods,
02571       !!procedures, authorization keys, or other information required to install
02572       !!and execute modified versions of a covered work in that User Product from
02573       !!a modified version of its Corresponding Source.  The information must
02574       !!suffice to ensure that the continued functioning of the modified object
02575       !!code is in no case prevented or interfered with solely because
02576       !!modification has been made.
02577       !!
02578       !!If you convey an object code work under this section in, or with, or
02579       !!specifically for use in, a User Product, and the conveying occurs as
02580       !!part of a transaction in which the right of possession and use of the
02581       !!User Product is transferred to the recipient in perpetuity or for a
02582       !!fixed term (regardless of how the transaction is characterized), the
02583       !!Corresponding Source conveyed under this section must be accompanied
02584       !!by the Installation Information.  But this requirement does not apply
02585       !!if neither you nor any third party retains the ability to install
02586       !!modified object code on the User Product (for example, the work has
02587       !!been installed in ROM).
02588       !!
02589       !!The requirement to provide Installation Information does not include a
02590       !!requirement to continue to provide support service, warranty, or updates
02591       !!for a work that has been modified or installed by the recipient, or for
02592       !!the User Product in which it has been modified or installed.  Access to a
02593       !!network may be denied when the modification itself materially and
02594       !!adversely affects the operation of the network or violates the rules and
02595       !!protocols for communication across the network.
02596       !!
02597       !!Corresponding Source conveyed, and Installation Information provided,
02598       !!in accord with this section must be in a format that is publicly
02599       !!documented (and with an implementation available to the public in
02600       !!source code form), and must require no special password or key for
02601       !!unpacking, reading or copying.
02602       !!
02603       !!\item Additional Terms.
02604       !!
02605       !!``Additional permissions'' are terms that supplement the terms of this
02606       !!License by making exceptions from one or more of its conditions.
02607       !!Additional permissions that are applicable to the entire Program shall
02608       !!be treated as though they were included in this License, to the extent
02609       !!that they are valid under applicable law.  If additional permissions
02610       !!apply only to part of the Program, that part may be used separately
02611       !!under those permissions, but the entire Program remains governed by
02612       !!this License without regard to the additional permissions.
02613       !!
02614       !!When you convey a copy of a covered work, you may at your option
02615       !!remove any additional permissions from that copy, or from any part of
02616       !!it.  (Additional permissions may be written to require their own
02617       !!removal in certain cases when you modify the work.)  You may place
02618       !!additional permissions on material, added by you to a covered work,
02619       !!for which you have or can give appropriate copyright permission.
02620       !!
02621       !!Notwithstanding any other provision of this License, for material you
02622       !!add to a covered work, you may (if authorized by the copyright holders of
02623       !!that material) supplement the terms of this License with terms:
02624       !!  \begin{enumerate}
02625       !!  \item Disclaiming warranty or limiting liability differently from the
02626       !!  terms of sections 15 and 16 of this License; or
02627       !!
02628       !!  \item Requiring preservation of specified reasonable legal notices or
02629       !!  author attributions in that material or in the Appropriate Legal
02630       !!  Notices displayed by works containing it; or
02631       !!
02632       !!  \item Prohibiting misrepresentation of the origin of that material, or
02633       !!  requiring that modified versions of such material be marked in
02634       !!  reasonable ways as different from the original version; or
02635       !!
02636       !!  \item Limiting the use for publicity purposes of names of licensors or
02637       !!  authors of the material; or
02638       !!
02639       !!  \item Declining to grant rights under trademark law for use of some
02640       !!  trade names, trademarks, or service marks; or
02641       !!
02642       !!  \item Requiring indemnification of licensors and authors of that
02643       !!  material by anyone who conveys the material (or modified versions of
02644       !!  it) with contractual assumptions of liability to the recipient, for
02645       !!  any liability that these contractual assumptions directly impose on
02646       !!  those licensors and authors.
02647       !!  \end{enumerate}
02648       !!
02649       !!All other non-permissive additional terms are considered ``further
02650       !!restrictions'' within the meaning of section 10.  If the Program as you
02651       !!received it, or any part of it, contains a notice stating that it is
02652       !!governed by this License along with a term that is a further
02653       !!restriction, you may remove that term.  If a license document contains
02654       !!a further restriction but permits relicensing or conveying under this
02655       !!License, you may add to a covered work material governed by the terms
02656       !!of that license document, provided that the further restriction does
02657       !!not survive such relicensing or conveying.
02658       !!
02659       !!If you add terms to a covered work in accord with this section, you
02660       !!must place, in the relevant source files, a statement of the
02661       !!additional terms that apply to those files, or a notice indicating
02662       !!where to find the applicable terms.
02663       !!
02664       !!Additional terms, permissive or non-permissive, may be stated in the
02665       !!form of a separately written license, or stated as exceptions;
02666       !!the above requirements apply either way.
02667       !!
02668       !!\item Termination.
02669       !!
02670       !!You may not propagate or modify a covered work except as expressly
02671       !!provided under this License.  Any attempt otherwise to propagate or
02672       !!modify it is void, and will automatically terminate your rights under
02673       !!this License (including any patent licenses granted under the third
02674       !!paragraph of section 11).
02675       !!
02676       !!However, if you cease all violation of this License, then your
02677       !!license from a particular copyright holder is reinstated (a)
02678       !!provisionally, unless and until the copyright holder explicitly and
02679       !!finally terminates your license, and (b) permanently, if the copyright
02680       !!holder fails to notify you of the violation by some reasonable means
02681       !!prior to 60 days after the cessation.
02682       !!
02683       !!Moreover, your license from a particular copyright holder is
02684       !!reinstated permanently if the copyright holder notifies you of the
02685       !!violation by some reasonable means, this is the first time you have
02686       !!received notice of violation of this License (for any work) from that
02687       !!copyright holder, and you cure the violation prior to 30 days after
02688       !!your receipt of the notice.
02689       !!
02690       !!Termination of your rights under this section does not terminate the
02691       !!licenses of parties who have received copies or rights from you under
02692       !!this License.  If your rights have been terminated and not permanently
02693       !!reinstated, you do not qualify to receive new licenses for the same
02694       !!material under section 10.
02695       !!
02696       !!\item Acceptance Not Required for Having Copies.
02697       !!
02698       !!You are not required to accept this License in order to receive or
02699       !!run a copy of the Program.  Ancillary propagation of a covered work
02700       !!occurring solely as a consequence of using peer-to-peer transmission
02701       !!to receive a copy likewise does not require acceptance.  However,
02702       !!nothing other than this License grants you permission to propagate or
02703       !!modify any covered work.  These actions infringe copyright if you do
02704       !!not accept this License.  Therefore, by modifying or propagating a
02705       !!covered work, you indicate your acceptance of this License to do so.
02706       !!
02707       !!\item Automatic Licensing of Downstream Recipients.
02708       !!
02709       !!Each time you convey a covered work, the recipient automatically
02710       !!receives a license from the original licensors, to run, modify and
02711       !!propagate that work, subject to this License.  You are not responsible
02712       !!for enforcing compliance by third parties with this License.
02713       !!
02714       !!An ``entity transaction'' is a transaction transferring control of an
02715       !!organization, or substantially all assets of one, or subdividing an
02716       !!organization, or merging organizations.  If propagation of a covered
02717       !!work results from an entity transaction, each party to that
02718       !!transaction who receives a copy of the work also receives whatever
02719       !!licenses to the work the party's predecessor in interest had or could
02720       !!give under the previous paragraph, plus a right to possession of the
02721       !!Corresponding Source of the work from the predecessor in interest, if
02722       !!the predecessor has it or can get it with reasonable efforts.
02723       !!
02724       !!You may not impose any further restrictions on the exercise of the
02725       !!rights granted or affirmed under this License.  For example, you may
02726       !!not impose a license fee, royalty, or other charge for exercise of
02727       !!rights granted under this License, and you may not initiate litigation
02728       !!(including a cross-claim or counterclaim in a lawsuit) alleging that
02729       !!any patent claim is infringed by making, using, selling, offering for
02730       !!sale, or importing the Program or any portion of it.
02731       !!
02732       !!\item Patents.
02733       !!
02734       !!A ``contributor'' is a copyright holder who authorizes use under this
02735       !!License of the Program or a work on which the Program is based.  The
02736       !!work thus licensed is called the contributor's ``contributor version''.
02737       !!
02738       !!A contributor's ``essential patent claims'' are all patent claims
02739       !!owned or controlled by the contributor, whether already acquired or
02740       !!hereafter acquired, that would be infringed by some manner, permitted
02741       !!by this License, of making, using, or selling its contributor version,
02742       !!but do not include claims that would be infringed only as a
02743       !!consequence of further modification of the contributor version.  For
02744       !!purposes of this definition, ``control'' includes the right to grant
02745       !!patent sublicenses in a manner consistent with the requirements of
02746       !!this License.
02747       !!
02748       !!Each contributor grants you a non-exclusive, worldwide, royalty-free
02749       !!patent license under the contributor's essential patent claims, to
02750       !!make, use, sell, offer for sale, import and otherwise run, modify and
02751       !!propagate the contents of its contributor version.
02752       !!
02753       !!In the following three paragraphs, a ``patent license'' is any express
02754       !!agreement or commitment, however denominated, not to enforce a patent
02755       !!(such as an express permission to practice a patent or covenant not to
02756       !!sue for patent infringement).  To ``grant'' such a patent license to a
02757       !!party means to make such an agreement or commitment not to enforce a
02758       !!patent against the party.
02759       !!
02760       !!If you convey a covered work, knowingly relying on a patent license,
02761       !!and the Corresponding Source of the work is not available for anyone
02762       !!to copy, free of charge and under the terms of this License, through a
02763       !!publicly available network server or other readily accessible means,
02764       !!then you must either (1) cause the Corresponding Source to be so
02765       !!available, or (2) arrange to deprive yourself of the benefit of the
02766       !!patent license for this particular work, or (3) arrange, in a manner
02767       !!consistent with the requirements of this License, to extend the patent
02768       !!license to downstream recipients.  ``Knowingly relying'' means you have
02769       !!actual knowledge that, but for the patent license, your conveying the
02770       !!covered work in a country, or your recipient's use of the covered work
02771       !!in a country, would infringe one or more identifiable patents in that
02772       !!country that you have reason to believe are valid.
02773       !!
02774       !!If, pursuant to or in connection with a single transaction or
02775       !!arrangement, you convey, or propagate by procuring conveyance of, a
02776       !!covered work, and grant a patent license to some of the parties
02777       !!receiving the covered work authorizing them to use, propagate, modify
02778       !!or convey a specific copy of the covered work, then the patent license
02779       !!you grant is automatically extended to all recipients of the covered
02780       !!work and works based on it.
02781       !!
02782       !!A patent license is ``discriminatory'' if it does not include within
02783       !!the scope of its coverage, prohibits the exercise of, or is
02784       !!conditioned on the non-exercise of one or more of the rights that are
02785       !!specifically granted under this License.  You may not convey a covered
02786       !!work if you are a party to an arrangement with a third party that is
02787       !!in the business of distributing software, under which you make payment
02788       !!to the third party based on the extent of your activity of conveying
02789       !!the work, and under which the third party grants, to any of the
02790       !!parties who would receive the covered work from you, a discriminatory
02791       !!patent license (a) in connection with copies of the covered work
02792       !!conveyed by you (or copies made from those copies), or (b) primarily
02793       !!for and in connection with specific products or compilations that
02794       !!contain the covered work, unless you entered into that arrangement,
02795       !!or that patent license was granted, prior to 28 March 2007.
02796       !!
02797       !!Nothing in this License shall be construed as excluding or limiting
02798       !!any implied license or other defenses to infringement that may
02799       !!otherwise be available to you under applicable patent law.
02800       !!
02801       !!\item No Surrender of Others' Freedom.
02802       !!
02803       !!If conditions are imposed on you (whether by court order, agreement or
02804       !!otherwise) that contradict the conditions of this License, they do not
02805       !!excuse you from the conditions of this License.  If you cannot convey a
02806       !!covered work so as to satisfy simultaneously your obligations under this
02807       !!License and any other pertinent obligations, then as a consequence you may
02808       !!not convey it at all.  For example, if you agree to terms that obligate you
02809       !!to collect a royalty for further conveying from those to whom you convey
02810       !!the Program, the only way you could satisfy both those terms and this
02811       !!License would be to refrain entirely from conveying the Program.
02812       !!
02813       !!\item Use with the GNU Affero General Public License.
02814       !!
02815       !!Notwithstanding any other provision of this License, you have
02816       !!permission to link or combine any covered work with a work licensed
02817       !!under version 3 of the GNU Affero General Public License into a single
02818       !!combined work, and to convey the resulting work.  The terms of this
02819       !!License will continue to apply to the part which is the covered work,
02820       !!but the special requirements of the GNU Affero General Public License,
02821       !!section 13, concerning interaction through a network will apply to the
02822       !!combination as such.
02823       !!
02824       !!\item Revised Versions of this License.
02825       !!
02826       !!The Free Software Foundation may publish revised and/or new versions of
02827       !!the GNU General Public License from time to time.  Such new versions will
02828       !!be similar in spirit to the present version, but may differ in detail to
02829       !!address new problems or concerns.
02830       !!
02831       !!Each version is given a distinguishing version number.  If the
02832       !!Program specifies that a certain numbered version of the GNU General
02833       !!Public License ``or any later version'' applies to it, you have the
02834       !!option of following the terms and conditions either of that numbered
02835       !!version or of any later version published by the Free Software
02836       !!Foundation.  If the Program does not specify a version number of the
02837       !!GNU General Public License, you may choose any version ever published
02838       !!by the Free Software Foundation.
02839       !!
02840       !!If the Program specifies that a proxy can decide which future
02841       !!versions of the GNU General Public License can be used, that proxy's
02842       !!public statement of acceptance of a version permanently authorizes you
02843       !!to choose that version for the Program.
02844       !!
02845       !!Later license versions may give you additional or different
02846       !!permissions.  However, no additional obligations are imposed on any
02847       !!author or copyright holder as a result of your choosing to follow a
02848       !!later version.
02849       !!
02850       !!\item Disclaimer of Warranty.
02851       !!
02852       !!\begin{sloppypar}
02853       !! THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
02854       !! APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE
02855       !! COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS''
02856       !! WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
02857       !! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
02858       !! MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE
02859       !! RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
02860       !! SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
02861       !! NECESSARY SERVICING, REPAIR OR CORRECTION.
02862       !!\end{sloppypar}
02863       !!
02864       !!\item Limitation of Liability.
02865       !!
02866       !! IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
02867       !! WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
02868       !! AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
02869       !! DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
02870       !! DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
02871       !! (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
02872       !! INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE
02873       !! OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
02874       !! HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
02875       !! DAMAGES.
02876       !!
02877       !!\item Interpretation of Sections 15 and 16.
02878       !!
02879       !!If the disclaimer of warranty and limitation of liability provided
02880       !!above cannot be given local legal effect according to their terms,
02881       !!reviewing courts shall apply local law that most closely approximates
02882       !!an absolute waiver of all civil liability in connection with the
02883       !!Program, unless a warranty or assumption of liability accompanies a
02884       !!copy of the Program in return for a fee.
02885       !!
02886       !!\begin{center}
02887       !!{\Large\sc End of Terms and Conditions}
02888       !!
02889       !!\bigskip
02890       !!How to Apply These Terms to Your New Programs
02891       !!\end{center}
02892       !!
02893       !!If you develop a new program, and you want it to be of the greatest
02894       !!possible use to the public, the best way to achieve this is to make it
02895       !!free software which everyone can redistribute and change under these terms.
02896       !!
02897       !!To do so, attach the following notices to the program.  It is safest
02898       !!to attach them to the start of each source file to most effectively
02899       !!state the exclusion of warranty; and each file should have at least
02900       !!the ``copyright'' line and a pointer to where the full notice is found.
02901       !!
02902       !!{\footnotesize
02903       !!\begin{verbatim}
02904       !!<one line to give the program's name and a brief idea of what it does.>
02905       !!
02906       !!Copyright (C) <textyear>  <name of author>
02907       !!
02908       !!This program is free software: you can redistribute it and/or modify
02909       !!it under the terms of the GNU General Public License as published by
02910       !!the Free Software Foundation, either version 3 of the License, or
02911       !!(at your option) any later version.
02912       !!
02913       !!This program is distributed in the hope that it will be useful,
02914       !!but WITHOUT ANY WARRANTY; without even the implied warranty of
02915       !!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
02916       !!GNU General Public License for more details.
02917       !!
02918       !!You should have received a copy of the GNU General Public License
02919       !!along with this program.  If not, see <http://www.gnu.org/licenses/>.
02920       !!\end{verbatim}
02921       !!}
02922       !!
02923       !!Also add information on how to contact you by electronic and paper mail.
02924       !!
02925       !!If the program does terminal interaction, make it output a short
02926       !!notice like this when it starts in an interactive mode:
02927       !!
02928       !!{\footnotesize
02929       !!\begin{verbatim}
02930       !!<program>  Copyright (C) <year>  <name of author>
02931       !!
02932       !!This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
02933       !!This is free software, and you are welcome to redistribute it
02934       !!under certain conditions; type `show c' for details.
02935       !!\end{verbatim}
02936       !!}
02937       !!
02938       !!The hypothetical commands {\tt show w} and {\tt show c} should show
02939       !!the appropriate
02940       !!parts of the General Public License.  Of course, your program's commands
02941       !!might be different; for a GUI interface, you would use an ``about box''.
02942       !!
02943       !!You should also get your employer (if you work as a programmer) or
02944       !!school, if any, to sign a ``copyright disclaimer'' for the program, if
02945       !!necessary.  For more information on this, and how to apply and follow
02946       !!the GNU GPL, see \texttt{http://www.gnu.org/licenses/}.
02947       !!
02948       !!The GNU General Public License does not permit incorporating your
02949       !!program into proprietary programs.  If your program is a subroutine
02950       !!library, you may consider it more useful to permit linking proprietary
02951       !!applications with the library.  If this is what you want to do, use
02952       !!the GNU Lesser General Public License instead of this License.  But
02953       !!first, please read \newline\texttt{http://www.gnu.org/philosophy/why-not-lgpl.html}.
02954       !!
02955       !!\end{enumerate}
02956 
02957       !(doc)footer

Generated on Fri Aug 31 2013 18:12:58 by S.E.Bourban (HRW) using doxygen 1.7.0