Grid.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Jolien Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 /***************************************** <lalVerbatim file="GridHV">
00021 Author: Creighton, T. D.
00022 $Id: Grid.h,v 1.3 2007/06/08 14:41:52 bema Exp $
00023 **************************************************** </lalVerbatim> */
00024 
00025 /********************************************************** <lalLaTeX>
00026 
00027 \section{Header \texttt{Grid.h}}
00028 \label{s:Grid.h}
00029 
00030 Provides a structured datatype for a multidimensional rectilinear
00031 grid.
00032 
00033 \subsection*{Synopsis}
00034 \begin{verbatim}
00035 #include <lal/Grid.h>
00036 \end{verbatim}
00037 
00038 \noindent This header provides a new structured datatype storing data
00039 on a multidimensional rectilinear grid.  It is in some sense a
00040 generalization of the series datatypes (frequency series, time series,
00041 etc.), representing evenly-sampled data over some physical parameter
00042 space.
00043 
00044 ******************************************************* </lalLaTeX> */
00045 
00046 #ifndef _GRID_H
00047 #define _GRID_H
00048 
00049 #include <lal/LALStdlib.h>
00050 
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054 
00055 NRCSID( GRIDH, "$Id: Grid.h,v 1.3 2007/06/08 14:41:52 bema Exp $" );
00056 
00057 /********************************************************** <lalLaTeX>
00058 \subsection*{Error conditions}
00059 ****************************************** </lalLaTeX><lalErrTable> */
00060 #define GRIDH_ENUL 1
00061 #define GRIDH_EOUT 2
00062 #define GRIDH_EMEM 3
00063 
00064 #define GRIDH_MSGENUL "Unexpected null pointer in arguments"
00065 #define GRIDH_MSGEOUT "Output handle points to a non-null pointer"
00066 #define GRIDH_MSGEMEM "Memory allocation error"
00067 /******************************************** </lalErrTable><lalLaTeX>
00068 
00069 \subsection*{Types}
00070 
00071 \subsubsection*{Structure \texttt{<datatype>Grid}}
00072 \idx[Type]{INT2Grid}
00073 \idx[Type]{INT4Grid}
00074 \idx[Type]{INT8Grid}
00075 \idx[Type]{UINT2Grid}
00076 \idx[Type]{UINT4Grid}
00077 \idx[Type]{UINT8Grid}
00078 \idx[Type]{REAL4Grid}
00079 \idx[Type]{REAL8Grid}
00080 \idx[Type]{COMPLEX8Grid}
00081 \idx[Type]{COMPLEX16Grid}
00082 
00083 \noindent This structure is a generalization of the LAL series types,
00084 storing data on an $m$-dimensional rectangular grid on a physical
00085 parameter space.  The values on the grid are of type \verb@<datatype>@
00086 which can be any LAL primitive \emph{numerical} datatype (\verb@INT2@,
00087 \verb@INT4@, \verb@INT8@, \verb@UINT2@, \verb@UINT4@, \verb@UINT8@,
00088 \verb@REAL4@, \verb@REAL8@, \verb@COMPLEX8@, \verb@COMPLEX16@).  The
00089 data are stored in an array of dimension $M\geq m$: if $M=m$, then the
00090 structure stores a single value for each grid point; if $M>m$, then
00091 the structure stores a vector or array of values on the ``tangent
00092 space'' of each grid point.  We refer to $m$ as the \emph{grid}
00093 dimension and $M$ as the \emph{data} dimension.  The fields of the
00094 structure are:
00095 
00096 \begin{description}
00097 \item[\texttt{CHAR name[LALNameLength]}] A name identifying the grid
00098 and/or the data being sampled.
00099 
00100 \item[\texttt{LALUnit sampleUnits}] The physical units of the
00101 quantities on the grid.
00102 
00103 \item[\texttt{LALUnit *dimUnits}] The physical units of the grid axes.
00104 This must be allocated as an array of length $m$.
00105 
00106 \item[\texttt{REAL8Vector *offset}] A vector $\mathbf{p}_0$
00107 specifying the location of the grid point indexed by $(0,\ldots,0)$.
00108 Must have dimensionality $m$.
00109 
00110 \item[\texttt{REAL8Vector *interval}] The vector $\Delta\mathbf{p}$
00111 specifying the grid spacing in each dimension.  Must have
00112 dimensionality $m$.
00113 
00114 \item[\texttt{<datatype>Array *data}] Pointer to an array storing the
00115 data values at the corresponding grid points.  The data dimension
00116 $M=$\verb@data->dimLength->length@ must be greater than or equal to
00117 the grid dimension $m=$\verb@offset->length@=\verb@interval->length@.
00118 An index $\mathbf{i}=(i_0,\ldots,i_{M-1})$, where $i_k$ are integers
00119 from 0 to \verb@data->dimLength->data@${}_k$, specifies a grid point
00120 located at $\mathbf{p}=\mathbf{p}_0+\sum_{k=0}^{n-1}\hat{\mathbf{e}}_k
00121 i_k \Delta p_k$ if $M=m$, or an array element $\mathsf{A}_{i_m\cdots
00122 i_{M-1}}$ at that grid point if $M>m$.  The values in
00123 \verb@data->data@ are the value stored at each grid point (or array
00124 element at each grid point), arranged in the manner discussed in
00125 \verb@LALDatatypes.h@.
00126 \end{description}
00127 ******************************************************* </lalLaTeX> */
00128 
00129 typedef struct tagINT2Grid {
00130   CHAR name[LALNameLength];
00131   LALUnit sampleUnits;
00132   LALUnit *dimUnits;
00133   REAL8Vector *offset;
00134   REAL8Vector *interval;
00135   INT2Array *data;
00136 } INT2Grid;
00137 
00138 typedef struct tagINT4Grid {
00139   CHAR name[LALNameLength];
00140   LALUnit sampleUnits;
00141   LALUnit *dimUnits;
00142   REAL8Vector *offset;
00143   REAL8Vector *interval;
00144   INT4Array *data;
00145 } INT4Grid;
00146 
00147 typedef struct tagINT8Grid {
00148   CHAR name[LALNameLength];
00149   LALUnit sampleUnits;
00150   LALUnit *dimUnits;
00151   REAL8Vector *offset;
00152   REAL8Vector *interval;
00153   INT8Array *data;
00154 } INT8Grid;
00155 
00156 typedef struct tagUINT2Grid {
00157   CHAR name[LALNameLength];
00158   LALUnit sampleUnits;
00159   LALUnit *dimUnits;
00160   REAL8Vector *offset;
00161   REAL8Vector *interval;
00162   UINT2Array *data;
00163 } UINT2Grid;
00164 
00165 typedef struct tagUINT4Grid {
00166   CHAR name[LALNameLength];
00167   LALUnit sampleUnits;
00168   LALUnit *dimUnits;
00169   REAL8Vector *offset;
00170   REAL8Vector *interval;
00171   UINT4Array *data;
00172 } UINT4Grid;
00173 
00174 typedef struct tagUINT8Grid {
00175   CHAR name[LALNameLength];
00176   LALUnit sampleUnits;
00177   LALUnit *dimUnits;
00178   REAL8Vector *offset;
00179   REAL8Vector *interval;
00180   UINT8Array *data;
00181 } UINT8Grid;
00182 
00183 typedef struct tagREAL4Grid {
00184   CHAR name[LALNameLength];
00185   LALUnit sampleUnits;
00186   LALUnit *dimUnits;
00187   REAL8Vector *offset;
00188   REAL8Vector *interval;
00189   REAL4Array *data;
00190 } REAL4Grid;
00191 
00192 typedef struct tagREAL8Grid {
00193   CHAR name[LALNameLength];
00194   LALUnit sampleUnits;
00195   LALUnit *dimUnits;
00196   REAL8Vector *offset;
00197   REAL8Vector *interval;
00198   REAL8Array *data;
00199 } REAL8Grid;
00200 
00201 typedef struct tagCOMPLEX8Grid {
00202   CHAR name[LALNameLength];
00203   LALUnit sampleUnits;
00204   LALUnit *dimUnits;
00205   REAL8Vector *offset;
00206   REAL8Vector *interval;
00207   COMPLEX8Array *data;
00208 } COMPLEX8Grid;
00209 
00210 typedef struct tagCOMPLEX16Grid {
00211   CHAR name[LALNameLength];
00212   LALUnit sampleUnits;
00213   LALUnit *dimUnits;
00214   REAL8Vector *offset;
00215   REAL8Vector *interval;
00216   COMPLEX16Array *data;
00217 } COMPLEX16Grid;
00218 
00219 
00220 /* <lalLaTeX>
00221 \vfill{\footnotesize\input{GridHV}}
00222 </lalLaTeX> */
00223 
00224 /* Function prototypes. */
00225 
00226 /* <lalLaTeX>
00227 \newpage\input{GridC}
00228 </lalLaTeX> */
00229 void
00230 LALI2CreateGrid( LALStatus *status, INT2Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00231 
00232 void
00233 LALI4CreateGrid( LALStatus *status, INT4Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00234 
00235 void
00236 LALI8CreateGrid( LALStatus *status, INT8Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00237 
00238 void
00239 LALU2CreateGrid( LALStatus *status, UINT2Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00240 
00241 void
00242 LALU4CreateGrid( LALStatus *status, UINT4Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00243 
00244 void
00245 LALU8CreateGrid( LALStatus *status, UINT8Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00246 
00247 void
00248 LALSCreateGrid( LALStatus *status, REAL4Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00249 
00250 void
00251 LALDCreateGrid( LALStatus *status, REAL8Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00252 
00253 void
00254 LALCCreateGrid( LALStatus *status, COMPLEX8Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00255 
00256 void
00257 LALZCreateGrid( LALStatus *status, COMPLEX16Grid **grid, UINT4Vector *dimLength, UINT4 dimension );
00258 
00259 
00260 void
00261 LALI2DestroyGrid( LALStatus *status, INT2Grid **grid );
00262 
00263 void
00264 LALI4DestroyGrid( LALStatus *status, INT4Grid **grid );
00265 
00266 void
00267 LALI8DestroyGrid( LALStatus *status, INT8Grid **grid );
00268 
00269 void
00270 LALU2DestroyGrid( LALStatus *status, UINT2Grid **grid );
00271 
00272 void
00273 LALU4DestroyGrid( LALStatus *status, UINT4Grid **grid );
00274 
00275 void
00276 LALU8DestroyGrid( LALStatus *status, UINT8Grid **grid );
00277 
00278 void
00279 LALSDestroyGrid( LALStatus *status, REAL4Grid **grid );
00280 
00281 void
00282 LALDDestroyGrid( LALStatus *status, REAL8Grid **grid );
00283 
00284 void
00285 LALCDestroyGrid( LALStatus *status, COMPLEX8Grid **grid );
00286 
00287 void
00288 LALZDestroyGrid( LALStatus *status, COMPLEX16Grid **grid );
00289 
00290 /* <lalLaTeX>
00291 %\newpage\input{GridTestC}
00292 </lalLaTeX> */
00293 
00294 #ifdef __cplusplus
00295 }
00296 #endif
00297 
00298 #endif /* _GRID_H */

Generated on Tue Oct 7 02:39:50 2008 for LAL by  doxygen 1.5.2