$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

multiGridDataField2D.h

Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 /* Main author: Daniel Lagrava
00026  **/
00027 
00028 #ifndef MULTI_GRID_DATA_FIELD_2D_H
00029 #define MULTI_GRID_DATA_FIELD_2D_H
00030 
00031 #include "core/globalDefs.h"
00032 
00033 namespace plb {
00034 
00035 template<typename T>
00036 class MultiGridScalarField2D : public ScalarFieldBase2D<T>, public MultiGrid2D {
00037     public:
00038         MultiGridScalarField2D (
00039                         MultiGridManagement2D management_,
00040                         std::vector<BlockCommunicator2D* > communicators_,
00041                         std::vector<CombinedStatistics*> combinedStatistics_, 
00042                         plint behaviorLevel_=0 );
00043 
00044         MultiGridScalarField2D (
00045                         MultiGridManagement2D management_,
00046                         plint behaviorLevel_=0 );
00047                         
00048         
00049                         
00050         MultiGridScalarField2D(MultiGridScalarField2D<T> const& rhs);
00051         MultiGridScalarField2D(MultiGrid2D const& rhs);
00052         MultiGridScalarField2D(MultiGrid2D const& rhs, Box2D subDomain, bool crop=true);
00053         
00054         ~MultiGridScalarField2D();
00055         
00056     /* ************ ScalarFieldBase2D ************* */
00057     public:
00058         void reset();
00059         T& get(plint iX, plint iY);
00060         T const& get(plint iX, plint iY) const;
00061         
00062     /* ************ MultiGrid2D ************* */    
00063     public:
00064         MultiScalarField2D<T>& getComponent(plint level);
00065         MultiScalarField2D<T> const& getComponent(plint level) const;
00066         int getBlockId() const;
00067         
00068         std::auto_ptr<MultiScalarField2D<T> > convertToCoarsest(plint dimDx, plint dimDt);
00069         std::auto_ptr<MultiScalarField2D<T> > convertToFinest(plint dimDx, plint dimDt);
00070    
00071     private:
00073         void allocateFields();
00074         void allocateFields( std::vector<BlockCommunicator2D* > communicators,
00075                              std::vector<CombinedStatistics*> combinedStatistics );
00076     private:
00077         std::vector<MultiScalarField2D<T> *> fields;
00078 };
00079 
00080 
00081 template<typename T, int nDim>
00082 class MultiGridTensorField2D : public TensorFieldBase2D<T,nDim>, public MultiGrid2D {
00083     public:
00084         MultiGridTensorField2D (
00085                         MultiGridManagement2D management_,
00086                         std::vector<BlockCommunicator2D* > communicators_,
00087                         std::vector<CombinedStatistics*> combinedStatistics_, 
00088                         plint behaviorLevel_=0 );
00089 
00090         MultiGridTensorField2D (
00091                         MultiGridManagement2D management_,
00092                         plint behaviorLevel_=0 );
00093                         
00094         MultiGridTensorField2D(MultiGridTensorField2D<T,nDim> const& rhs);
00095         MultiGridTensorField2D(MultiGrid2D const& rhs);
00096         MultiGridTensorField2D(MultiGrid2D const& rhs, Box2D subDomain, bool crop=true);
00097 
00098         ~MultiGridTensorField2D();
00099         
00100     /* ************ TensorFieldBase2D ************* */
00101     public:
00102         void reset();
00103         virtual Array<T,nDim>& get(plint iX, plint iY);
00104         virtual Array<T,nDim> const& get(plint iX, plint iY) const;
00105         
00106     /* ************ MultiGrid2D ************* */    
00107     public:
00108         MultiTensorField2D<T,nDim>& getComponent(plint level);
00109         MultiTensorField2D<T,nDim> const& getComponent(plint level) const;
00110         int getBlockId() const;
00111         
00112         std::auto_ptr<MultiTensorField2D<T,nDim> > convertToCoarsest(plint dimDx, plint dimDt);
00113         std::auto_ptr<MultiTensorField2D<T,nDim> > convertToFinest(plint dimDx, plint dimDt);
00114         
00115     private:
00117         void allocateFields();
00118         void allocateFields( std::vector<BlockCommunicator2D* > communicators,
00119                              std::vector<CombinedStatistics*> combinedStatistics );
00120 
00121     private:
00122         std::vector<MultiTensorField2D<T,nDim> *> fields;
00123 };
00124 
00125 
00126 
00127 } // namespace plb
00128 
00129 #endif  // MULTI_GRID_DATA_FIELD_2D_H
00130