OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FieldSpec.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef FIELD_SPEC_H
12 #define FIELD_SPEC_H
13 
14 // forward declarations
15 template< unsigned Dim, class T > class UniformCartesian;
16 template< class T, unsigned Dim , class M, class C > class BConds;
17 template< unsigned Dim > class GuardCellSizes;
18 template< unsigned Dim > class FieldLayout;
19 
20 // A simple container class for the three entities used to create a Field:
21 // FieldLayout, Bconds, and GaurdCellSizes.
22 // The FieldLayout must be a reference since fields on different layouts
23 // will not know how to talk to each other in parallel
24 
25 template<class T, unsigned Dim,
26  class M=UniformCartesian<Dim,double>,class C= typename M::DefaultCentering>
27 class FieldSpec
28 {
29 public:
30  // Bconds and GuardCellSizes have default constructors, so
31  // they can be set later. However, we can not have a default
32  // constructor for FieldSpec since a reference to a layout
33  // is required which is common to all FieldSpecs
34  FieldSpec(const FieldLayout<Dim>& layout) : Layout(layout) { };
35 
36  FieldSpec(const FieldLayout<Dim>& layout,
37  const BConds<T,Dim,M,C>& bc,
38  const GuardCellSizes<Dim>& gc) :
39  Layout(layout), BC(bc), GC(gc) { };
40 
41  FieldSpec(const FieldLayout<Dim>& layout,
42  const GuardCellSizes<Dim>& gc,
43  const BConds<T,Dim,M,C>& bc) :
44  Layout(layout), BC(bc), GC(gc) { };
45 
47  Layout(rhs.get_Layout()), BC(rhs.get_BC()), GC(rhs.get_GC() ) { };
48 
49  ~FieldSpec(void) { };
50 
51  const FieldLayout<Dim>& get_Layout(void) const { return Layout; }
52  BConds<T,Dim,M,C> get_BC(void) const { return BC; }
53  GuardCellSizes<Dim> get_GC(void) const { return GC; }
54  void set_BC(const BConds<T,Dim,M,C>& bc) { BC = bc; }
55  void set_GC(const GuardCellSizes<Dim>& gc) { GC = gc; }
56 
58  BC = rhs.get_BC();
59  GC = rhs.get_GC();
60  if( &Layout != &(rhs.get_Layout()) ) {
61  ERRORMSG("FieldSpec::op= - FieldLayouts must be the same"<<endl);
62  }
63  return *this;
64  }
65 
66 private:
67 
71 
72 };
73 
74 #endif // FIELD_SPEC_H
75 
76 /***************************************************************************
77  * $RCSfile: FieldSpec.h,v $ $Author: adelmann $
78  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
79  * IPPL_VERSION_ID: $Id: FieldSpec.h,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
80  ***************************************************************************/
const unsigned Dim
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
#define ERRORMSG(msg)
Definition: IpplInfo.h:350
Definition: BCond.h:199
BConds< T, Dim, M, C > get_BC(void) const
Definition: FieldSpec.h:52
~FieldSpec(void)
Definition: FieldSpec.h:49
void set_BC(const BConds< T, Dim, M, C > &bc)
Definition: FieldSpec.h:54
const FieldLayout< Dim > & Layout
Definition: FieldSpec.h:68
FieldSpec(const FieldLayout< Dim > &layout, const GuardCellSizes< Dim > &gc, const BConds< T, Dim, M, C > &bc)
Definition: FieldSpec.h:41
FieldSpec(const FieldLayout< Dim > &layout)
Definition: FieldSpec.h:34
BConds< T, Dim, M, C > BC
Definition: FieldSpec.h:69
void set_GC(const GuardCellSizes< Dim > &gc)
Definition: FieldSpec.h:55
FieldSpec(const FieldSpec< T, Dim, M, C > &rhs)
Definition: FieldSpec.h:46
const FieldLayout< Dim > & get_Layout(void) const
Definition: FieldSpec.h:51
FieldSpec< T, Dim, M, C > & operator=(const FieldSpec< T, Dim, M, C > &rhs)
Definition: FieldSpec.h:57
FieldSpec(const FieldLayout< Dim > &layout, const BConds< T, Dim, M, C > &bc, const GuardCellSizes< Dim > &gc)
Definition: FieldSpec.h:36
GuardCellSizes< Dim > get_GC(void) const
Definition: FieldSpec.h:53
GuardCellSizes< Dim > GC
Definition: FieldSpec.h:70