src/Field/FieldSpec.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef FIELD_SPEC_H
00012 #define FIELD_SPEC_H
00013 
00014 // forward declarations
00015 template< unsigned Dim, class T > class UniformCartesian;
00016 template< class T, unsigned Dim , class M, class C > class BConds;
00017 template< unsigned Dim > class GuardCellSizes;
00018 template< unsigned Dim > class FieldLayout;
00019 
00020 // A simple container class for the three entities used to create a Field:
00021 // FieldLayout, Bconds, and GaurdCellSizes.
00022 // The FieldLayout must be a reference since fields on different layouts
00023 // will not know how to talk to each other in parallel
00024 
00025 template<class T, unsigned Dim,
00026   class M=UniformCartesian<Dim,double>,class C= typename M::DefaultCentering>
00027 class FieldSpec 
00028 {
00029 public:
00030   // Bconds and GuardCellSizes have default constructors, so
00031   // they can be set later. However, we can not have a default
00032   // constructor for FieldSpec since a reference to a layout
00033   // is required which is common to all FieldSpecs
00034   FieldSpec(const FieldLayout<Dim>& layout) : Layout(layout) { };
00035   
00036   FieldSpec(const FieldLayout<Dim>& layout, 
00037             const BConds<T,Dim,M,C>& bc, 
00038             const GuardCellSizes<Dim>& gc) : 
00039     Layout(layout), BC(bc), GC(gc) { };
00040   
00041   FieldSpec(const FieldLayout<Dim>& layout, 
00042             const GuardCellSizes<Dim>& gc,
00043             const BConds<T,Dim,M,C>& bc) : 
00044     Layout(layout), BC(bc), GC(gc) { };
00045   
00046   FieldSpec(const FieldSpec<T,Dim,M,C>& rhs ) :
00047     Layout(rhs.get_Layout()), BC(rhs.get_BC()), GC(rhs.get_GC() ) { };
00048 
00049   ~FieldSpec(void) { };
00050   
00051   const FieldLayout<Dim>& get_Layout(void) const { return Layout; }
00052   BConds<T,Dim,M,C> get_BC(void)  const { return BC; } 
00053   GuardCellSizes<Dim> get_GC(void)  const { return GC; }
00054   void set_BC(const BConds<T,Dim,M,C>& bc)  { BC = bc; } 
00055   void set_GC(const GuardCellSizes<Dim>& gc)  { GC = gc; }
00056 
00057   FieldSpec<T,Dim,M,C>& operator=(const FieldSpec<T,Dim,M,C>& rhs) {
00058     BC = rhs.get_BC();
00059     GC = rhs.get_GC();
00060     if( &Layout != &(rhs.get_Layout()) ) {
00061       ERRORMSG("FieldSpec::op= - FieldLayouts must be the same"<<endl);
00062     }
00063     return *this;
00064   }
00065 
00066 private:
00067   
00068   const FieldLayout<Dim>& Layout;
00069   BConds<T,Dim,M,C> BC; 
00070   GuardCellSizes<Dim> GC;
00071 
00072 };
00073 
00074 #endif // FIELD_SPEC_H
00075 
00076 /***************************************************************************
00077  * $RCSfile: FieldSpec.h,v $   $Author: adelmann $
00078  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:26 $
00079  * IPPL_VERSION_ID: $Id: FieldSpec.h,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $ 
00080  ***************************************************************************/

Generated on Mon Jan 16 13:23:44 2006 for IPPL by  doxygen 1.4.6