00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef FIELD_H
00012 #define FIELD_H
00013
00014
00015 #include "Field/BareField.h"
00016 #include "Field/FieldSpec.h"
00017 #include "Field/LField.h"
00018 #include "Field/BCond.h"
00019 #include "Field/ReductionLoc.h"
00020 #include "SubField/SubField.h"
00021 #include "DataSource/DataSource.h"
00022 #include "Meshes/UniformCartesian.h"
00023
00024
00025 template <class T, unsigned D, unsigned B, class M, class C>
00026 class IndexedField;
00027
00028
00029
00030
00031
00032
00033
00034 template<class T, unsigned Dim,
00035 class M=UniformCartesian<Dim,double>,
00036 class C=typename M::DefaultCentering >
00037 class Field : public BareField<T,Dim>, public DataSource {
00038
00039 friend class BareFieldIterator<T,Dim>;
00040
00041 public:
00042
00043 typedef M Mesh_t;
00044 typedef C Centering_t;
00045 typedef BareField<T,Dim> Base_t;
00046 typedef FieldLayout<Dim> Layout_t;
00047 typedef BConds<T,Dim,M,C> bcond_container;
00048 typedef BCondBase<T,Dim,M,C> bcond_value;
00049 typedef typename bcond_container::iterator bcond_iterator;
00050
00051
00052
00053
00054
00055 Field();
00056
00057
00058 virtual ~Field();
00059
00060
00061
00062
00063
00064 Field(Layout_t &);
00065 Field(Layout_t &,const GuardCellSizes<Dim>&);
00066 Field(Layout_t &,const BConds<T,Dim,M,C>&);
00067 Field(Layout_t &,const GuardCellSizes<Dim>&,const BConds<T,Dim,M,C>&);
00068 Field(Layout_t &,const BConds<T,Dim,M,C>&,const GuardCellSizes<Dim>&);
00069 Field(FieldSpec<T,Dim,M,C>&);
00070
00071
00072 Field(Mesh_t&, Layout_t &);
00073 Field(Mesh_t&, Layout_t &, const GuardCellSizes<Dim>&);
00074 Field(Mesh_t&, Layout_t &, const BConds<T,Dim,M,C>&);
00075 Field(Mesh_t&, Layout_t &, const GuardCellSizes<Dim>&,
00076 const BConds<T,Dim,M,C>&);
00077 Field(Mesh_t&, Layout_t &, const BConds<T,Dim,M,C>&,
00078 const GuardCellSizes<Dim>&);
00079 Field(Mesh_t&, FieldSpec<T,Dim,M,C>&);
00080
00081
00082
00083
00084 void initialize(Layout_t &);
00085 void initialize(Layout_t &, const GuardCellSizes<Dim>&);
00086 void initialize(Layout_t &, const BConds<T,Dim,M,C>&);
00087 void initialize(Layout_t &, const GuardCellSizes<Dim>&,
00088 const BConds<T,Dim,M,C>&);
00089 void initialize(Layout_t &, const BConds<T,Dim,M,C>&,
00090 const GuardCellSizes<Dim>&);
00091 void initialize(FieldSpec<T,Dim,M,C>&);
00092
00093
00094 void initialize(Mesh_t&, Layout_t &);
00095 void initialize(Mesh_t&, Layout_t &, const GuardCellSizes<Dim>&);
00096 void initialize(Mesh_t&, Layout_t &, const BConds<T,Dim,M,C>&);
00097 void initialize(Mesh_t&, Layout_t &, const GuardCellSizes<Dim>&,
00098 const BConds<T,Dim,M,C>&);
00099 void initialize(Mesh_t&, Layout_t &, const BConds<T,Dim,M,C>&,
00100 const GuardCellSizes<Dim>&);
00101 void initialize(Mesh_t&, FieldSpec<T,Dim,M,C>&);
00102
00103
00104 const bcond_value& getBCond(int bc) const { return *(Bc[bc]); }
00105 bcond_value& getBCond(int bc) { return *(Bc[bc]); }
00106 const bcond_container& getBConds() const { return Bc; }
00107 bcond_container& getBConds() { return Bc; }
00108 bcond_iterator begin_BConds() { return Bc.begin(); }
00109 bcond_iterator end_BConds() { return Bc.end(); }
00110
00111
00112 Mesh_t& get_mesh() const { return *mesh; }
00113
00114
00115
00116
00117
00118
00119 IndexedField<T,Dim,1,M,C> operator[](const Index&);
00120 IndexedField<T,Dim,1,M,C> operator[](int);
00121 IndexedField<T,Dim,Dim,M,C> operator[](const NDIndex<Dim>&);
00122 SubField<T,Dim,M,C,SIndex<Dim> > operator[](const SIndex<Dim>&);
00123
00124
00125 const Field<T,Dim,M,C>& operator=(T x) {
00126 assign(*this,x);
00127 return *this;
00128 }
00129
00130 const Field<T,Dim,M,C>& operator=(const Field<T,Dim,M,C>& x) {
00131 assign(*this,x);
00132 return *this;
00133 }
00134
00135 template<class X>
00136 const Field<T,Dim,M,C>& operator=(const BareField<X,Dim>& x) {
00137 assign(*this,x);
00138 return *this;
00139 }
00140
00141 template<class B>
00142 const Field<T,Dim,M,C>& operator=(const PETE_Expr<B>& x) {
00143 assign(*this,x);
00144 return *this;
00145 }
00146
00147
00148 void fillGuardCells(bool reallyFill = true) const;
00149
00150
00151
00152 void print_Centerings(ostream&);
00153
00154
00155
00156
00157
00158
00159 virtual void Repartition(UserList *);
00160
00161
00162 virtual void notifyUserOfDelete(UserList *);
00163
00164 protected:
00165
00166
00167
00168 virtual DataSourceObject *createDataSourceObject(const char *, DataConnect *,
00169 int);
00170
00171 private:
00172
00173 bcond_container Bc;
00174
00175
00176 Mesh_t* mesh;
00177 bool WeOwnMesh;
00178
00179
00180
00181 void store_mesh(Mesh_t*, bool);
00182
00183
00184 void delete_mesh();
00185 };
00186
00187 #include "Field/Field.cpp"
00188
00189 #endif // FIELD_H
00190
00191
00192
00193
00194
00195