nvector_nrnserial_ld.h

Go to the documentation of this file.
00001 /*
00002 * N_Vector_NrnSerialLD derived from N_Vector_Serial Sundials version
00003 * by replaceing every occurrence of Serial with NrnSerialLD and then
00004 * modifying relevant method implementations to allow long double
00005 * accumulation.
00006 */
00007 /*
00008 Macros changed with
00009 sed 's/NV_\([A-Za-z_]*\)_S/NV_\1_S_LD/g' nvector_nrnserial_ld.h >temp
00010 mv temp nvector_nrnserial_ld.h
00011 sed 's/NV_\([A-Za-z_]*\)_S/NV_\1_S_LD/g' nvector_nrnserial_ld.c >temp
00012 mv temp nvector_nrnserial_ld.c
00013 */
00014 
00015 /*
00016  * -----------------------------------------------------------------
00017  * $Revision: 855 $
00018  * $Date: 2005-02-10 00:15:46 +0100 (Thu, 10 Feb 2005) $
00019  * ----------------------------------------------------------------- 
00020  * Programmer(s): Scott D. Cohen, Alan C. Hindmarsh, Radu Serban,
00021  *                and Aaron Collier @ LLNL
00022  * -----------------------------------------------------------------
00023  * Copyright (c) 2002, The Regents of the University of California.
00024  * Produced at the Lawrence Livermore National Laboratory.
00025  * All rights reserved.
00026  * For details, see sundials/shared/LICENSE.
00027  * -----------------------------------------------------------------
00028  * This is the header file for the serial implementation of the
00029  * NVECTOR module.
00030  *
00031  * Part I contains declarations specific to the serial
00032  * implementation of the supplied NVECTOR module.
00033  *
00034  * Part II defines accessor macros that allow the user to
00035  * efficiently use the type N_Vector without making explicit
00036  * references to the underlying data structure.
00037  *
00038  * Part III contains the prototype for the constructor N_VNew_NrnSerialLD
00039  * as well as implementation-specific prototypes for various useful
00040  * vector operations.
00041  *
00042  * Notes:
00043  *
00044  *   - The definition of the generic N_Vector structure can be found
00045  *     in the header file shared/include/nvector.h.
00046  *
00047  *   - The definition of the type realtype can be found in the
00048  *     header file shared/include/sundialstypes.h, and it may be
00049  *     changed (at the configuration stage) according to the user's
00050  *     needs. The sundialstypes.h file also contains the definition
00051  *     for the type booleantype.
00052  *
00053  *   - N_Vector arguments to arithmetic vector operations need not
00054  *     be distinct. For example, the following call:
00055  *
00056  *       N_VLinearSum_NrnSerialLD(a,x,b,y,y);
00057  *
00058  *     (which stores the result of the operation a*x+b*y in y)
00059  *     is legal.
00060  * -----------------------------------------------------------------
00061  */
00062 
00063 #ifndef _NVECTOR_NRNSERIAL_LD_H
00064 #define _NVECTOR_NRNSERIAL_LD_H
00065 
00066 #ifdef __cplusplus  /* wrapper to enable C++ usage */
00067 extern "C" {
00068 #endif
00069 
00070 #include "nvector.h"
00071 #include "sundialstypes.h"
00072 
00073 /*
00074  * -----------------------------------------------------------------
00075  * PART I: SERIAL implementation of N_Vector
00076  * -----------------------------------------------------------------
00077  */
00078 
00079 /* serial implementation of the N_Vector 'content' structure
00080    contains the length of the vector, a pointer to an array
00081    of realtype components, and a flag indicating ownership of
00082    the data */
00083 
00084 struct _N_VectorContent_NrnSerialLD {
00085   long int length;
00086   booleantype own_data;
00087   realtype *data;
00088 };
00089 
00090 typedef struct _N_VectorContent_NrnSerialLD *N_VectorContent_NrnSerialLD;
00091 
00092 /*
00093  * -----------------------------------------------------------------
00094  * PART II: macros NV_CONTENT_S_LD, NV_DATA_S_LD, NV_OWN_DATA_S_LD,
00095  *          NV_LENGTH_S_LD, and NV_Ith_S_LD
00096  * -----------------------------------------------------------------
00097  * In the descriptions below, the following user declarations
00098  * are assumed:
00099  *
00100  * N_Vector v;
00101  * long int i;
00102  *
00103  * (1) NV_CONTENT_S_LD
00104  *
00105  *     This routines gives access to the contents of the serial
00106  *     vector N_Vector.
00107  *
00108  *     The assignment v_cont = NV_CONTENT_S_LD(v) sets v_cont to be
00109  *     a pointer to the serial N_Vector content structure.
00110  *
00111  * (2) NV_DATA_S_LD NV_OWN_DATA_S_LD and NV_LENGTH_S_LD
00112  *
00113  *     These routines give access to the individual parts of
00114  *     the content structure of a serial N_Vector.
00115  *
00116  *     The assignment v_data = NV_DATA_S_LD(v) sets v_data to be
00117  *     a pointer to the first component of v. The assignment
00118  *     NV_DATA_S_LD(v) = data_V sets the component array of v to
00119  *     be data_v by storing the pointer data_v.
00120  *
00121  *     The assignment v_len = NV_LENGTH_S_LD(v) sets v_len to be
00122  *     the length of v. The call NV_LENGTH_S_LD(v) = len_v sets
00123  *     the length of v to be len_v.
00124  *
00125  * (3) NV_Ith_S_LD
00126  *
00127  *     In the following description, the components of an
00128  *     N_Vector are numbered 0..n-1, where n is the length of v.
00129  *
00130  *     The assignment r = NV_Ith_S_LD(v,i) sets r to be the value of
00131  *     the ith component of v. The assignment NV_Ith_S_LD(v,i) = r
00132  *     sets the value of the ith component of v to be r.
00133  *
00134  * Note: When looping over the components of an N_Vector v, it is
00135  * more efficient to first obtain the component array via
00136  * v_data = NV_DATA_S_LD(v) and then access v_data[i] within the
00137  * loop than it is to use NV_Ith_S_LD(v,i) within the loop.
00138  * -----------------------------------------------------------------
00139  */
00140 
00141 #define NV_CONTENT_S_LD(v)  ( (N_VectorContent_NrnSerialLD)(v->content) )
00142 
00143 #define NV_LENGTH_S_LD(v)   ( NV_CONTENT_S_LD(v)->length )
00144 
00145 #define NV_OWN_DATA_S_LD(v) ( NV_CONTENT_S_LD(v)->own_data )
00146 
00147 #define NV_DATA_S_LD(v)     ( NV_CONTENT_S_LD(v)->data )
00148 
00149 #define NV_Ith_S_LD(v,i)    ( NV_DATA_S_LD(v)[i] )
00150 
00151 /*
00152  * -----------------------------------------------------------------
00153  * PART III: functions exported by nvector_serial
00154  * 
00155  * CONSTRUCTORS:
00156  *    N_VNew_NrnSerialLD
00157  *    N_VNewEmpty_NrnSerialLD
00158  *    N_VClone_NrnSerialLD
00159  *    N_VCloneEmpty_NrnSerialLD
00160  *    N_VMake_NrnSerialLD
00161  *    N_VNewVectorArray_NrnSerialLD
00162  *    N_VNewVectorArrayEmpty_NrnSerialLD
00163  * DESTRUCTORS:
00164  *    N_VDestroy_NrnSerialLD
00165  *    N_VDestroyVectorArray_NrnSerialLD
00166  * -----------------------------------------------------------------
00167  */
00168 
00169 /*
00170  * -----------------------------------------------------------------
00171  * Function : N_VNew_NrnSerialLD
00172  * -----------------------------------------------------------------
00173  * This function creates and allocates memory for a serial vector.
00174  * -----------------------------------------------------------------
00175  */
00176 
00177 N_Vector N_VNew_NrnSerialLD(long int vec_length);
00178 
00179 /*
00180  * -----------------------------------------------------------------
00181  * Function : N_VNewEmpty_NrnSerialLD
00182  * -----------------------------------------------------------------
00183  * This function creates a new serial N_Vector with an empty (NULL)
00184  * data array.
00185  * -----------------------------------------------------------------
00186  */
00187 
00188 N_Vector N_VNewEmpty_NrnSerialLD(long int vec_length);
00189 
00190 /*
00191  * -----------------------------------------------------------------
00192  * Function : N_VCloneEmpty_NrnSerialLD
00193  * -----------------------------------------------------------------
00194  * This function creates a new serial N_Vector with an empty (NULL)
00195  * data array.
00196  * -----------------------------------------------------------------
00197  */
00198 
00199 N_Vector N_VCloneEmpty_NrnSerialLD(N_Vector w);
00200 
00201 /*
00202  * -----------------------------------------------------------------
00203  * Function : N_VMake_NrnSerialLD
00204  * -----------------------------------------------------------------
00205  * This function creates and allocates memory for a serial vector
00206  * with a user-supplied data array.
00207  * -----------------------------------------------------------------
00208  */
00209 
00210 N_Vector N_VMake_NrnSerialLD(long int vec_length, realtype *v_data);
00211 
00212 /*
00213  * -----------------------------------------------------------------
00214  * Function : N_VNewVectorArray_NrnSerialLD
00215  * -----------------------------------------------------------------
00216  * This function creates an array of 'count' serial vectors. This
00217  * array of N_Vectors can be freed using N_VDestroyVectorArray
00218  * (defined by the generic NVECTOR module).
00219  * -----------------------------------------------------------------
00220  */
00221 
00222 N_Vector *N_VNewVectorArray_NrnSerialLD(int count, long int vec_length);
00223 
00224 /*
00225  * -----------------------------------------------------------------
00226  * Function : N_VNewVectorArrayEmpty_NrnSerialLD
00227  * -----------------------------------------------------------------
00228  * This function creates an array of 'count' serial vectors each
00229  * with an empty (NULL) data array.
00230  * -----------------------------------------------------------------
00231  */
00232 
00233 N_Vector *N_VNewVectorArrayEmpty_NrnSerialLD(int count, long int vec_length);
00234 
00235 /*
00236  * -----------------------------------------------------------------
00237  * Function : N_VDestroyVectorArray_NrnSerialLD
00238  * -----------------------------------------------------------------
00239  * This function frees an array of N_Vector created with 
00240  * N_VNewVectorArray_NrnSerialLD.
00241  * -----------------------------------------------------------------
00242  */
00243 
00244 void N_VDestroyVectorArray_NrnSerialLD(N_Vector *vs, int count);
00245 
00246 /*
00247  * -----------------------------------------------------------------
00248  * Function : N_VPrint_NrnSerialLD
00249  * -----------------------------------------------------------------
00250  * This function prints the content of a serial vector to stdout.
00251  * -----------------------------------------------------------------
00252  */
00253 
00254 void N_VPrint_NrnSerialLD(N_Vector v);
00255 
00256 /*
00257  * -----------------------------------------------------------------
00258  * serial implementations of various useful vector operations
00259  * -----------------------------------------------------------------
00260  */
00261 
00262 N_Vector N_VClone_NrnSerialLD(N_Vector w);
00263 void N_VDestroy_NrnSerialLD(N_Vector v);
00264 void N_VSpace_NrnSerialLD(N_Vector v, long int *lrw, long int *liw);
00265 realtype *N_VGetArrayPointer_NrnSerialLD(N_Vector v);
00266 void N_VSetArrayPointer_NrnSerialLD(realtype *v_data, N_Vector v);
00267 void N_VLinearSum_NrnSerialLD(realtype a, N_Vector x, realtype b, N_Vector y, N_Vector z);
00268 void N_VConst_NrnSerialLD(realtype c, N_Vector z);
00269 void N_VProd_NrnSerialLD(N_Vector x, N_Vector y, N_Vector z);
00270 void N_VDiv_NrnSerialLD(N_Vector x, N_Vector y, N_Vector z);
00271 void N_VScale_NrnSerialLD(realtype c, N_Vector x, N_Vector z);
00272 void N_VAbs_NrnSerialLD(N_Vector x, N_Vector z);
00273 void N_VInv_NrnSerialLD(N_Vector x, N_Vector z);
00274 void N_VAddConst_NrnSerialLD(N_Vector x, realtype b, N_Vector z);
00275 realtype N_VDotProd_NrnSerialLD(N_Vector x, N_Vector y);
00276 realtype N_VMaxNorm_NrnSerialLD(N_Vector x);
00277 realtype N_VWrmsNorm_NrnSerialLD(N_Vector x, N_Vector w);
00278 realtype N_VWrmsNormMask_NrnSerialLD(N_Vector x, N_Vector w, N_Vector id);
00279 realtype N_VMin_NrnSerialLD(N_Vector x);
00280 realtype N_VWL2Norm_NrnSerialLD(N_Vector x, N_Vector w);
00281 realtype N_VL1Norm_NrnSerialLD(N_Vector x);
00282 void N_VCompare_NrnSerialLD(realtype c, N_Vector x, N_Vector z);
00283 booleantype N_VInvTest_NrnSerialLD(N_Vector x, N_Vector z);
00284 booleantype N_VConstrMask_NrnSerialLD(N_Vector c, N_Vector x, N_Vector m);
00285 realtype N_VMinQuotient_NrnSerialLD(N_Vector num, N_Vector denom);
00286 
00287 #ifdef __cplusplus
00288 }
00289 #endif
00290 
00291 #endif
Generated on Mon Jun 13 08:10:26 2011 for NEURON by  doxygen 1.6.3