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


Main Page   Class Hierarchy   Compound List   File List  

AMRVarSolverControl.h

Go to the documentation of this file.
00001 #ifndef AMROC_AMR_VAR_SOLVER_CONTROL_H
00002 #define AMROC_AMR_VAR_SOLVER_CONTROL_H
00003 
00011 #include "AMRSolverControl.h"
00012 
00013 #ifndef AMRVarSolverControlName
00014 #define AMRVarSolverControl(dim)      name2(AMRVarSolverControl,dim)
00015 #define AMRVarSolverControlName
00016 #endif
00017 
00026 template <class VectorType, class FixupType, class FlagType>
00027 class AMRVarSolverControl(DIM) : 
00028   public AMRSolverControl(DIM)<VectorType,FixupType,FlagType> {
00029   typedef AMRSolverControl(DIM)<VectorType,FixupType,FlagType> amr_solver_type;
00030   typedef typename VectorType::InternalDataType DataType;
00031 
00032   typedef GridFunction(DIM)<VectorType> vec_grid_fct_type;  
00033   typedef GridFunction(DIM)<DataType>   grid_fct_type;   
00034 public:
00035   AMRVarSolverControl(DIM)(AMRSolver(DIM)<VectorType,FixupType,FlagType>& solver,
00036                            const int no) : amr_solver_type(solver), _nout(no) {}
00037 
00038   virtual void WriteOut(GridHierarchy& GH, vec_grid_fct_type& u,
00039                         grid_fct_type& IOfunc) {
00040     int Time;       
00041     int me = MY_PROC(GH); 
00042     Time = CurrentTime(GH,0); 
00043     Solver_().SetLastOutputTime(Time);
00044     char ioname[DAGHBktGFNameWidth+16];
00045     for (int i=0; i<NOutputs(); i++) { 
00046       if (CompName[i].c_str()[0] == '-') 
00047         continue;
00048       sprintf(ioname,"%s_%d",CompName[i].c_str(),Time); 
00049       if (me == VizServer) 
00050         cout << " *** Writing: " << ioname << endl;   
00051       for (int lev=0; lev<=FineLevel(GH); lev++) {
00052         Time = CurrentTime(GH,lev); 
00053         forall (u,Time,lev,c)       
00054           f_out(FORTRAN_ARGS(DIM,u(Time,lev,c)), 
00055                 FORTRAN_ARGS(DIM,IOfunc(Time,lev,c)),
00056                 BOUNDING_BOX(u(Time,lev,c)),NEquations(),i);
00057         end_forall      
00058         SetPhysicalTime(IOfunc,Time,lev,GetPhysicalTime(u,Time,lev));
00059         Write(IOfunc,Time,lev,DAGH_Double,ioname);      
00060       }
00061       // This barrier ensures that SDsclose() is called only once!
00062 #ifndef DAGH_NO_MPI
00063       MPI_Barrier(comm_service::comm()); 
00064 #endif
00065     }
00066   }  
00067 
00068   virtual int NOutputs() const { return (_nout); }
00069 protected:
00070   int _nout;
00071 };
00072 
00073 
00074 #endif      


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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