AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

ClpInitialCondition.h

Go to the documentation of this file.
00001 #ifndef AMROC_CLP_INITIALCONDITION_H
00002 #define AMROC_CLP_INITIALCONDITION_H
00003 
00011 #include "InitialCondition.h"
00012 
00013 #ifndef ClpInitialConditionName
00014 #define ClpInitialCondition(dim)      name2(ClpInitialCondition,dim)
00015 #define ClpInitialConditionName
00016 #endif
00017 
00026 template <class VectorType>
00027 class ClpInitialCondition(DIM) : public InitialCondition(DIM)<VectorType> {
00028   typedef typename VectorType::InternalDataType DataType;
00029   typedef GridData(DIM)<VectorType> vec_grid_data_type;
00030 
00031 public:
00032   ClpInitialCondition(DIM)(const int gh) :
00033     InitialCondition(DIM)<VectorType>(gh) {}
00034 
00035   virtual void SetGrid(vec_grid_data_type& gd, DCoords& dx) {    
00036     Coords ex = gd.extents();
00037     DCoords lbcorner = GH().worldCoords(gd.lower(), gd.stepsize());
00038     int maxm[DIM], mx[DIM], d;
00039     DataType* x[DIM];
00040     for (d=0; d<DIM; d++) {
00041       maxm[d] = ex(d);
00042       mx[d] = ex(d)-2*NGhosts();
00043       x[d] = new DataType[maxm[d]];
00044       for (int i=0; i<maxm[d]; i++) x[d][i] = (i+0.5)*dx(d)+lbcorner(d);
00045     }
00046 
00047     f_initial(AA(DIM,mx), NEquations(), NGhosts(), AA(DIM,mx), 
00048               AA(DIM,x), AA(DIM,dx()), gd.data()); 
00049 
00050     for (d=0; d<DIM; d++) 
00051       delete [] x[d];
00052   }
00053 };
00054 
00055 
00056 
00057 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04