nvector_nrnthread_ld.h

Go to the documentation of this file.
00001 /*
00002 * N_Vector_NrnThreadLD derived from N_Vector_Serial SunDials version
00003 * by replacing every occurrence of nrnthread with nrnthread in the various
00004 * cases and then modifying the relevant prototypes.
00005 * We only re-implement the ones that are used by cvodes and ida
00006 */
00007 /*
00008 Macros changed with
00009 sed 's/NV_\([A-Za-z_]*\)_NT/NV_\1_NT_LD/g' nvector_nrnthread_ld.c > temp
00010 mv temp nvector_nrnthread_ld.c
00011 sed 's/NV_\([A-Za-z_]*\)_NT/NV_\1_NT_LD/g' nvector_nrnthread_ld.h >temp
00012 mv temp nvector_nrnthread_ld.h
00013 */
00014 /*
00015  * -----------------------------------------------------------------
00016  * $Revision: 855 $
00017  * $Date: 2005-02-09 18:15:46 -0500 (Wed, 09 Feb 2005) $
00018  * ----------------------------------------------------------------- 
00019  * Programmer(s): Scott D. Cohen, Alan C. Hindmarsh, Radu Serban,
00020  *                and Aaron Collier @ LLNL
00021  * -----------------------------------------------------------------
00022  * Copyright (c) 2002, The Regents of the University of California.
00023  * Produced at the Lawrence Livermore National Laboratory.
00024  * All rights reserved.
00025  * For details, see sundials/shared/LICENSE.
00026  * -----------------------------------------------------------------
00027  * This is the header file for the nrnthread implementation of the
00028  * NVECTOR module.
00029  *
00030  * Part I contains declarations specific to the nrnthread
00031  * implementation of the supplied NVECTOR module.
00032  *
00033  * Part II defines accessor macros that allow the user to
00034  * efficiently use the type N_Vector without making explicit
00035  * references to the underlying data structure.
00036  *
00037  * Part III contains the prototype for the constructor N_VNew_NrnThreadLD
00038  * as well as implementation-specific prototypes for various useful
00039  * vector operations.
00040  *
00041  * Notes:
00042  *
00043  *   - The definition of the generic N_Vector structure can be found
00044  *     in the header file shared/include/nvector.h.
00045  *
00046  *   - The definition of the type realtype can be found in the
00047  *     header file shared/include/sundialstypes.h, and it may be
00048  *     changed (at the configuration stage) according to the user's
00049  *     needs. The sundialstypes.h file also contains the definition
00050  *     for the type booleantype.
00051  *
00052  *   - N_Vector arguments to arithmetic vector operations need not
00053  *     be distinct. For example, the following call:
00054  *
00055  *       N_VLinearSum_NrnThreadLD(a,x,b,y,y);
00056  *
00057  *     (which stores the result of the operation a*x+b*y in y)
00058  *     is legal.
00059  * -----------------------------------------------------------------
00060  */
00061 
00062 #ifndef _NVECTOR_NRNTHREAD_LD_H
00063 #define _NVECTOR_NRNTHREAD_LD_H
00064 
00065 #ifdef __cplusplus  /* wrapper to enable C++ usage */
00066 extern "C" {
00067 #endif
00068 
00069 #include "nvector.h"
00070 #include "sundialstypes.h"
00071 
00072 /*
00073  * -----------------------------------------------------------------
00074  * PART I: NRNTHREAD implementation of N_Vector
00075  * -----------------------------------------------------------------
00076  */
00077 
00078 /* nrnthread implementation of the N_Vector 'content' structure
00079    contains the length of the vector, nthread, and a pointer to
00080    nthread N_Vector (serial)
00081 */
00082 
00083 struct _N_VectorContent_NrnThreadLD {
00084   long int length;
00085   int nt; /* number of threads */
00086   booleantype own_data;
00087   N_Vector *data; /* nt of them (N_Vector_Serial) */
00088 };
00089 
00090 typedef struct _N_VectorContent_NrnThreadLD *N_VectorContent_NrnThreadLD;
00091 
00092 /* Note: documentation below may not be completely transformed from the
00093    N_Vector_Serial case
00094 */
00095 
00096 /*
00097  * -----------------------------------------------------------------
00098  * PART II: macros NV_CONTENT_S, NV_DATA_S, NV_OWN_DATA_S,
00099  *          NV_LENGTH_S, and NV_Ith_S
00100  * -----------------------------------------------------------------
00101  * In the descriptions below, the following user declarations
00102  * are assumed:
00103  *
00104  * N_Vector v;
00105  * long int i;
00106  *
00107  * (1) NV_CONTENT_NT_LD
00108  *
00109  *     This routines gives access to the contents of the nrnthread
00110  *     vector N_Vector.
00111  *
00112  *     The assignment v_cont = NV_CONTENT_NT_LD(v) sets v_cont to be
00113  *     a pointer to the nrnthread N_Vector content structure.
00114  *
00115  * (2) NV_SUBVEC_NT_LD and NV_LENGTH_NT_LD
00116  *
00117  *     These routines give access to the individual parts of
00118  *     the content structure of a nrnthread N_Vector.
00119  *
00120  *     The assignment v_data = NV_SUBVEC_NT_LD(v, i) sets v_data to be
00121  *     a pointer to the ith N_Vector of v. The assignment
00122  *     NV_SUBVEC_NT_LD(v, i) = data_V sets the ith component N_Vector of v to
00123  *     be data_v by storing the pointer data_v.
00124  *
00125  *     The assignment v_llen = NV_SIZE_NT_LD(v,i) sets v_llen to be
00126  *     the length of the ith component of v. The call NV_LENGTH_NT_LD(v) = len_v sets
00127  *     the length of v to be len_v.
00128  *
00129  * (3) NV_Ith_NT_LD
00130  *
00131  *     In the following description, the components of an
00132  *     N_Vector are numbered 0..n-1, where n is the length of v.
00133  *
00134  *     The assignment r = NV_Ith_S(v,i) sets r to be the value of
00135  *     the ith component of v. The assignment NV_Ith_S(v,i) = r
00136  *     sets the value of the ith component of v to be r.
00137  *
00138  * Note: When looping over the components of an N_Vector v, it is
00139  * more efficient to first obtain the component array via
00140  * v_data = NV_DATA_S(v) and then access v_data[i] within the
00141  * loop than it is to use NV_Ith_S(v,i) within the loop.
00142  * -----------------------------------------------------------------
00143  */
00144 
00145 #define NV_CONTENT_NT_LD(v)  ( (N_VectorContent_NrnThreadLD)(v->content) )
00146 
00147 #define NV_LENGTH_NT_LD(v)   ( NV_CONTENT_NT_LD(v)->length )
00148 
00149 #define NV_NT_NT_LD(v)   ( NV_CONTENT_NT_LD(v)->nt )
00150 
00151 #define NV_OWN_DATA_NT_LD(v) ( NV_CONTENT_NT_LD(v)->own_data )
00152 
00153 #define NV_DATA_NT_LD(v)     ( NV_CONTENT_NT_LD(v)->data )
00154 
00155 #define NV_SUBVEC_NT_LD(v, i)     ( NV_CONTENT_NT_LD(v)->data[i] )
00156 
00157 #define NV_Ith_NT_LD(v,i)    ( NV_DATA_NT_LD(v)[i] ) /* wrong but not needed */
00158 
00159 /*
00160  * -----------------------------------------------------------------
00161  * PART III: functions exported by nvector_nrnthread
00162  * 
00163  * CONSTRUCTORS:
00164  *    N_VNew_NrnThreadLD
00165  *    N_VNewEmpty_NrnThreadLD
00166  *    N_VClone_NrnThreadLD
00167  *    N_VCloneEmpty_NrnThreadLD
00168  *    N_VMake_NrnThreadLD
00169  *    N_VNewVectorArray_NrnThreadLD
00170  *    N_VNewVectorArrayEmpty_NrnThreadLD
00171  * DESTRUCTORS:
00172  *    N_VDestroy_NrnThreadLD
00173  *    N_VDestroyVectorArray_NrnThreadLD
00174  * -----------------------------------------------------------------
00175  */
00176 
00177 /*
00178  * -----------------------------------------------------------------
00179  * Function : N_VNew_NrnThreadLD
00180  * -----------------------------------------------------------------
00181  * This function creates and allocates memory for a nrnthread vector.
00182  * -----------------------------------------------------------------
00183  */
00184 
00185 N_Vector N_VNew_NrnThreadLD(long int vec_length, int nthread, long int* sizes );
00186 
00187 /*
00188  * -----------------------------------------------------------------
00189  * Function : N_VNewEmpty_NrnThreadLD
00190  * -----------------------------------------------------------------
00191  * This function creates a new nrnthread N_Vector with an empty (NULL)
00192  * data array.
00193  * -----------------------------------------------------------------
00194  */
00195 
00196 N_Vector N_VNewEmpty_NrnThreadLD(long int vec_length, int nthread, long int* sizes);
00197 
00198 /*
00199  * -----------------------------------------------------------------
00200  * Function : N_VCloneEmpty_NrnThreadLD
00201  * -----------------------------------------------------------------
00202  * This function creates a new nrnthread N_Vector with an empty (NULL)
00203  * data array.
00204  * -----------------------------------------------------------------
00205  */
00206 
00207 N_Vector N_VCloneEmpty_NrnThreadLD(N_Vector w);
00208 
00209 /*
00210  * -----------------------------------------------------------------
00211  * Function : N_VMake_NrnThreadLD
00212  * -----------------------------------------------------------------
00213  * This function creates and allocates memory for a nrnthread vector
00214  * with a user-supplied data array.
00215  * -----------------------------------------------------------------
00216  */
00217 
00218 /*not implemented*/
00219 N_Vector N_VMake_NrnThreadLD(long int vec_length, realtype *v_data);
00220 
00221 /*
00222  * -----------------------------------------------------------------
00223  * Function : N_VNewVectorArray_NrnThreadLD
00224  * -----------------------------------------------------------------
00225  * This function creates an array of 'count' nrnthread vectors. This
00226  * array of N_Vectors can be freed using N_VDestroyVectorArray
00227  * (defined by the generic NVECTOR module).
00228  * -----------------------------------------------------------------
00229  */
00230 
00231 N_Vector *N_VNewVectorArray_NrnThreadLD(int count, long int vec_length,
00232    int nthread, long int* sizes);
00233 
00234 /*
00235  * -----------------------------------------------------------------
00236  * Function : N_VNewVectorArrayEmpty_NrnThreadLD
00237  * -----------------------------------------------------------------
00238  * This function creates an array of 'count' nrnthread vectors each
00239  * with an empty (NULL) data array.
00240  * -----------------------------------------------------------------
00241  */
00242 
00243 N_Vector *N_VNewVectorArrayEmpty_NrnThreadLD(int count, long int vec_length,
00244    int nthread, long int* sizes);
00245 
00246 /*
00247  * -----------------------------------------------------------------
00248  * Function : N_VDestroyVectorArray_NrnThreadLD
00249  * -----------------------------------------------------------------
00250  * This function frees an array of N_Vector created with 
00251  * N_VNewVectorArray_NrnThreadLD.
00252  * -----------------------------------------------------------------
00253  */
00254 
00255 void N_VDestroyVectorArray_NrnThreadLD(N_Vector *vs, int count);
00256 
00257 /*
00258  * -----------------------------------------------------------------
00259  * Function : N_VPrint_NrnThreadLD
00260  * -----------------------------------------------------------------
00261  * This function prints the content of a nrnthread vector to stdout.
00262  * -----------------------------------------------------------------
00263  */
00264 
00265 void N_VPrint_NrnThreadLD(N_Vector v);
00266 
00267 /*
00268  * -----------------------------------------------------------------
00269  * nrnthread implementations of various useful vector operations
00270  * -----------------------------------------------------------------
00271  */
00272 
00273 N_Vector N_VClone_NrnThreadLD(N_Vector w);
00274 void N_VDestroy_NrnThreadLD(N_Vector v);
00275 void N_VSpace_NrnThreadLD(N_Vector v, long int *lrw, long int *liw);
00276 realtype *N_VGetArrayPointer_NrnThreadLD(N_Vector v);
00277 void N_VSetArrayPointer_NrnThreadLD(realtype *v_data, N_Vector v);
00278 void N_VLinearSum_NrnThreadLD(realtype a, N_Vector x, realtype b, N_Vector y, N_Vector z);
00279 void N_VConst_NrnThreadLD(realtype c, N_Vector z);
00280 void N_VProd_NrnThreadLD(N_Vector x, N_Vector y, N_Vector z);
00281 void N_VDiv_NrnThreadLD(N_Vector x, N_Vector y, N_Vector z);
00282 void N_VScale_NrnThreadLD(realtype c, N_Vector x, N_Vector z);
00283 void N_VAbs_NrnThreadLD(N_Vector x, N_Vector z);
00284 void N_VInv_NrnThreadLD(N_Vector x, N_Vector z);
00285 void N_VAddConst_NrnThreadLD(N_Vector x, realtype b, N_Vector z);
00286 realtype N_VDotProd_NrnThreadLD(N_Vector x, N_Vector y);
00287 realtype N_VMaxNorm_NrnThreadLD(N_Vector x);
00288 realtype N_VWrmsNorm_NrnThreadLD(N_Vector x, N_Vector w);
00289 realtype N_VWrmsNormMask_NrnThreadLD(N_Vector x, N_Vector w, N_Vector id);
00290 realtype N_VMin_NrnThreadLD(N_Vector x);
00291 realtype N_VWL2Norm_NrnThreadLD(N_Vector x, N_Vector w);
00292 realtype N_VL1Norm_NrnThreadLD(N_Vector x);
00293 void N_VCompare_NrnThreadLD(realtype c, N_Vector x, N_Vector z);
00294 booleantype N_VInvTest_NrnThreadLD(N_Vector x, N_Vector z);
00295 booleantype N_VConstrMask_NrnThreadLD(N_Vector c, N_Vector x, N_Vector m);
00296 realtype N_VMinQuotient_NrnThreadLD(N_Vector num, N_Vector denom);
00297 
00298 #ifdef __cplusplus
00299 }
00300 #endif
00301 
00302 #endif
Generated on Mon Jun 13 08:10:26 2011 for NEURON by  doxygen 1.6.3