From 07bb3085a50ffcc9b6f9e605781eb54d27d310ca Mon Sep 17 00:00:00 2001 From: pollney Date: Wed, 11 Dec 2002 15:20:07 +0000 Subject: Switch mask to CCTK_INT rather than CCTK_INT8, as some fortran compilers have problems with the latter. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/SpaceMask/trunk@19 a491c6a4-70bf-4b89-8b36-d6c0cb1f094e --- doc/documentation.tex | 40 ++++++++++++++++++----------------- interface.ccl | 2 +- src/MaskUtils.c | 58 +++++++++++++++++++++++++-------------------------- src/SpaceMask.h | 12 +++++------ 4 files changed, 57 insertions(+), 55 deletions(-) diff --git a/doc/documentation.tex b/doc/documentation.tex index df64445..dc34f34 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -28,10 +28,12 @@ for quickly setting and checking the mask states. The mask is a grid function which can be used to assign a state to each point on the grid. It is used as a bit field, with different bits, or combinations of bits, assigned to represent various states. -The mask is currently implemented as a CCTK\_INT8 grid function, -providing 64 bits per point. Appropriate numbers of bits within -the mask can be allocated to represent individual states of -a given type. +The mask is currently implemented as a CCTK\_INT grid function, +providing 32 bits per point.\footnote{The original implementation of +these functions used a CCTK\_INT8 for 64 bits, however this data type +is not supported by some Fortran compilers.} Appropriate numbers of +bits within the mask can be allocated to represent individual states +of a given type. For instance, a programmer wants to record whether each point of the grid has \emph{state} ``interior'', ``excised'' or ``boundary''. The @@ -115,7 +117,7 @@ The state of the mask at a given point is set using the function: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ -void SpaceMask\_SetState(CCTK\_INT8* \emph{mask}, int \emph{point}, +void SpaceMask\_SetState(CCTK\_INT* \emph{mask}, int \emph{point}, char* \emph{type\_name}, char* \emph{state}) } \hspace*{10mm}\parbox{\linewidth}{ @@ -132,7 +134,7 @@ The state of the mask at a given point can be checked using: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ -int SpaceMask\_CheckState(CCTK\_INT8* \emph{mask}, int \emph{point}, +int SpaceMask\_CheckState(CCTK\_INT* \emph{mask}, int \emph{point}, char* \emph{type\_name}, char* \emph{state}) } \hspace*{10mm}\parbox{\linewidth}{ @@ -159,7 +161,7 @@ states need to be obtained using the following functions: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ -CCTK\_INT8 SpaceMask\_GetTypeBits(char* \emph{type\_name}) +CCTK\_INT SpaceMask\_GetTypeBits(char* \emph{type\_name}) }\\ \hspace*{10mm}\parbox{\linewidth}{ \begin{description} @@ -170,7 +172,7 @@ CCTK\_INT8 SpaceMask\_GetTypeBits(char* \emph{type\_name}) \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ -CCTK\_INT8 SpaceMask\_GetStateBits(char* \emph{type\_name}, +CCTK\_INT SpaceMask\_GetStateBits(char* \emph{type\_name}, char* \emph{state\_name}) } \hspace*{10mm}\parbox{\linewidth}{ @@ -192,8 +194,8 @@ of the mask by direct bitwise operations: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ -void SpaceMask\_SetStateBits(CCTK\_INT8* \emph{mask}, int \emph{point}, - CCTK\_INT8 \emph{type\_bits},\\\hspace*{10mm} CCTK\_INT8 \emph{state\_bits}) +void SpaceMask\_SetStateBits(CCTK\_INT* \emph{mask}, int \emph{point}, + CCTK\_INT \emph{type\_bits},\\\hspace*{10mm} CCTK\_INT \emph{state\_bits}) }\\ \hspace*{10mm}\parbox{\linewidth}{ \begin{description} @@ -209,8 +211,8 @@ void SpaceMask\_SetStateBits(CCTK\_INT8* \emph{mask}, int \emph{point}, \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ -int SpaceMask\_CheckStateBits(CCTK\_INT8* \emph{mask}, int \emph{point}, - CCTK\_INT8 \emph{type\_bits},\\\hspace*{10mm} CCTK\_INT8 \emph{state\_bits}) +int SpaceMask\_CheckStateBits(CCTK\_INT* \emph{mask}, int \emph{point}, + CCTK\_INT \emph{type\_bits},\\\hspace*{10mm} CCTK\_INT \emph{state\_bits}) }\\ \hspace*{10mm}\parbox{\linewidth}{ \begin{description} @@ -249,7 +251,7 @@ The mask states can be manipulated using the following functions: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ - SpaceMask\_SetState(CCTK\_INT8 \emph{mask(,,)}, int \emph{point}, + SpaceMask\_SetState(CCTK\_INT \emph{mask(,,)}, int \emph{point}, character \emph{type\_name},\\\hspace*{10mm} character \emph{state\_name}) }\\ \hspace*{10mm}\parbox{\linewidth}{ @@ -268,7 +270,7 @@ the specified state at the point. \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ - SpaceMask\_CheckState(CCTK\_INT \emph{check}, CCTK\_INT8 \emph{mask(,,)}, + SpaceMask\_CheckState(CCTK\_INT \emph{check}, CCTK\_INT \emph{mask(,,)}, int \emph{point},\\\hspace*{10mm} character \emph{type\_name}, character \emph{state\_name}) }\\ @@ -294,7 +296,7 @@ in question must first be obtained using the following functions: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ - SpaceMask\_GetTypeBits(CCTK\_INT8 \emph{type\_bits}, + SpaceMask\_GetTypeBits(CCTK\_INT \emph{type\_bits}, character \emph{type\_name}) } \hspace*{10mm}\parbox{\linewidth}{ @@ -307,7 +309,7 @@ in question must first be obtained using the following functions: \indent\parbox{\linewidth}{ \vspace{\baselineskip}\noindent\texttt{ - SpaceMask\_GetStateBits(CCTK\_INT8 \emph{state\_bits}, + SpaceMask\_GetStateBits(CCTK\_INT \emph{state\_bits}, character \emph{type\_name},\\\hspace*{10mm} character \emph{state\_name}) }\\ \hspace*{10mm}\parbox{\linewidth}{ @@ -425,8 +427,8 @@ void Eg_CheckMaskStates (CCTK_ARGUMENTS) int i, j, k, ijk; - CCTK_INT8 excision_mask; - CCTK_INT8 boundary_mask; + CCTK_INT excision_mask; + CCTK_INT boundary_mask; excision_mask = SpaceMask_GetTypeBits("excision"); boundary_mask = SpaceMask_GetStateBits("boundary"); @@ -505,7 +507,7 @@ subroutine Eg_SetExcisedRegionByBitmask(CCTK_ARGUMENTS) integer ni, nj, nk integer i, j, k, ijk - CCTK_INT8 type_bits, excised + CCTK_INT type_bits, excised ni = cctk_lsh(1) nj = cctk_lsh(2) diff --git a/interface.ccl b/interface.ccl index 70433bd..68d00da 100644 --- a/interface.ccl +++ b/interface.ccl @@ -8,7 +8,7 @@ USES INCLUDE: Symmetry.h public: -CCTK_INT8 space_mask_group type=GF +CCTK_INT space_mask_group type=GF { space_mask } diff --git a/src/MaskUtils.c b/src/MaskUtils.c index f8c5a75..5815eee 100644 --- a/src/MaskUtils.c +++ b/src/MaskUtils.c @@ -57,11 +57,11 @@ SpaceMask_get_bit_nbr(int nstates) @enddesc @@*/ -CCTK_INT8 +CCTK_INT SpaceMask_get_free_bits(int nbits) { - CCTK_INT8 used_bits; - CCTK_INT8 new_bits; + CCTK_INT used_bits; + CCTK_INT new_bits; int i; int j; int n; @@ -76,7 +76,7 @@ SpaceMask_get_free_bits(int nbits) n=1; new_bits = 0; j = 0; - for (i=0; i