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

dynamics.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 
00029 #ifndef DYNAMICS_H
00030 #define DYNAMICS_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "core/util.h"
00034 #include "core/blockStatistics.h"
00035 #include "core/array.h"
00036 #include "latticeBoltzmann/geometricOperationTemplates.h"
00037 
00038 namespace plb {
00039 
00040 namespace dynamicParams {
00041     // Use 0-99 for relaxation parameters
00042     const plint omega_shear = 0;
00043     const plint omega_bulk  = 1;
00044     
00045     const plint omega_epsilon  = 2;
00046     const plint omega_q        = 3;
00047 
00048     // Use 100-199 for material constants
00049     const plint sqrSpeedOfSound = 100; // Speed of sound squared
00050 
00051     // Use 1000 and higher for custom user-defined constants
00052 }
00053 
00054 template<typename T, template<typename U> class Descriptor> class Cell;
00055 class HierarchicSerializer;
00056 class HierarchicUnserializer;
00057 
00058 
00060 template<typename T, template<typename U> class Descriptor>
00061 struct Dynamics {
00062 /* *************** Construction, Descruction, and unique identifier ********* */
00063 
00065     virtual ~Dynamics() { }
00066 
00068     virtual Dynamics<T,Descriptor>* clone() const =0;
00069 
00071     virtual int getId() const;
00072 
00075     virtual bool velIsJ() const;
00076 
00079     virtual bool isComposite() const;
00080 
00082     virtual bool isComposeable() const;
00083 
00085     virtual bool isBoundary() const;
00086 
00087     // Say if the dynamics has non-local components.
00088     virtual bool isNonLocal() const;
00089 
00091     virtual void serialize(HierarchicSerializer& serializer) const;
00093     virtual void unserialize(HierarchicUnserializer& unserializer);
00094 
00095 /* *************** Collision, Equilibrium, and Non-equilibrium ************** */
00096 
00098     virtual void collide(Cell<T,Descriptor>& cell,
00099                          BlockStatistics& statistics_) =0;
00100 
00102     virtual void collide(Cell<T,Descriptor>& cell, T rhoBar,
00103                          Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat);
00104 
00106     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00107                                  T jSqr, T thetaBar=T()) const =0;
00108 
00109     virtual void computeEquilibria( Array<T,Descriptor<T>::q>& fEq,  T rhoBar, Array<T,Descriptor<T>::d> const& j,
00110                                     T jSqr, T thetaBar=T() ) const;
00111 
00113     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00114                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const =0;
00115 
00116 /* *************** Computation of macroscopic variables ********************* */
00117 
00119     virtual T computeDensity(Cell<T,Descriptor> const& cell) const =0;
00121     virtual T computePressure(Cell<T,Descriptor> const& cell) const =0;
00123     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00124                                   Array<T,Descriptor<T>::d>& u ) const =0;
00126     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const =0;
00128     virtual void computeDeviatoricStress (
00129         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const =0;
00131     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00132                                   Array<T,Descriptor<T>::d>& q ) const =0;
00134     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00135                                 plint momentId, T* moment ) const =0;
00136 
00137 /* *************** Access to Dynamics variables, e.g. omega ***************** */
00138 
00140     virtual T getOmega() const =0;
00141 
00143     virtual void setOmega(T omega_) =0;
00144 
00146     virtual T getParameter(plint whichParameter) const;
00147 
00149     virtual void setParameter(plint whichParameter, T value);
00150 
00151 /* *************** Switch between population and moment representation ****** */
00152 
00154 
00161     virtual plint numDecomposedVariables(plint order) const =0;
00162 
00164 
00169     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const =0;
00170 
00172 
00177     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const =0;
00178 
00180 
00184     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const =0;
00185 
00187 
00189     virtual void rescale(int dxScale, int dtScale);
00190 
00191 /* *************** Access Cell raw data through Dynamics ******************** */
00192 
00194 
00195     virtual void getPopulations(Cell<T,Descriptor> const& cell, Array<T,Descriptor<T>::q>& f) const;
00196 
00198 
00199     virtual void getExternalField (
00200             Cell<T,Descriptor> const& cell, plint pos, plint size, T* ext ) const;
00201 
00203 
00204     virtual void setPopulations(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::q> const& f);
00205 
00207 
00208     virtual void setExternalField (
00209             Cell<T,Descriptor>& cell, plint pos, plint size, const T* ext);
00210 
00211 
00212 /* *************** Define macroscopic variables, e.g. on boundaries ********* */
00213 
00215     virtual void defineDensity(Cell<T,Descriptor>& cell, T density);
00216 
00218     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& u);
00219 
00221     virtual void defineTemperature(Cell<T,Descriptor>& cell, T temperature);
00222 
00224     virtual void defineHeatFlux(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& q);
00225 
00227     virtual void defineDeviatoricStress(Cell<T,Descriptor>& cell,
00228                                         Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq);
00229 
00231     virtual void defineMoment(Cell<T,Descriptor>& cell, plint momentId, T const* value);
00232 
00233 /* *************** Additional moments, intended for internal use ************ */
00234 
00236     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const =0;
00237 
00239     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00240                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const =0;
00241 
00243     virtual T computeEbar(Cell<T,Descriptor> const& cell) const =0;
00244 
00247     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00248                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00249                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const =0;
00250 
00251 };
00252 
00253 
00255 
00266 template<typename T, template<typename U> class Descriptor>
00267 class BasicBulkDynamics : public Dynamics<T,Descriptor> {
00268 public:
00269 /* *************** Construction and Destruction ***************************** */
00270     BasicBulkDynamics(T omega_);
00271 
00272 /* *************** Computation of macroscopic variables ********************* */
00273 
00275     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00277     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00279     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00280                                   Array<T,Descriptor<T>::d>& u ) const;
00282     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00284     virtual void computeDeviatoricStress (
00285         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00287     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00288                                   Array<T,Descriptor<T>::d>& q ) const;
00290     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00291                                 plint momentId, T* moment ) const;
00292 
00293 /* *************** Access to Dynamics variables, e.g. omega ***************** */
00294 
00296     virtual T getOmega() const;
00297 
00299     virtual void setOmega(T omega_);
00300 
00301 /* *************** Additional moments, intended for internal use ************ */
00302 
00304     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00305 
00307     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00308                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00309 
00312     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00313                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00314                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00315 
00317     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00318 
00319 private:
00320     T omega; 
00321 };
00322 
00323 
00325 
00329 template<typename T, template<typename U> class Descriptor>
00330 class CompositeDynamics : public Dynamics<T,Descriptor> {
00331 public:
00332 /* *************** Construction and Destruction ***************************** */
00333 
00334     CompositeDynamics(Dynamics<T,Descriptor>* baseDynamics_, bool automaticPrepareCollision_);
00335     CompositeDynamics(CompositeDynamics<T,Descriptor> const& rhs);
00336     ~CompositeDynamics();
00337     CompositeDynamics& operator=(CompositeDynamics<T,Descriptor> const& rhs);
00338     virtual CompositeDynamics<T,Descriptor>* clone() const =0;
00340     virtual CompositeDynamics<T,Descriptor>* cloneWithNewBase (
00341             Dynamics<T,Descriptor>* baseDynamics_ ) const;
00342     virtual bool isComposite() const;
00344     virtual void serialize(HierarchicSerializer& serializer) const;
00346     virtual void unserialize(HierarchicUnserializer& unserializer);
00347 
00348 /* *************** Access to base Dynamics ********************************** */
00349 
00350     virtual void replaceBaseDynamics(Dynamics<T,Descriptor>* newBaseDynamics);
00351     Dynamics<T,Descriptor>& getBaseDynamics();
00352     Dynamics<T,Descriptor> const& getBaseDynamics() const;
00353 
00354 /* *************** Methods to be overloaded to configure behavior  ********** */
00355 
00357     virtual void prepareCollision(Cell<T,Descriptor>& cell) =0;
00358 
00359 /* *************** Collision, Equilibrium, and Non-equilibrium ************** */
00360 
00362     virtual void collide(Cell<T,Descriptor>& cell,
00363                          BlockStatistics& statistics);
00364 
00366     virtual void collide(Cell<T,Descriptor>& cell, T rhoBar,
00367                          Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat);
00368 
00370     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00371                                  T jSqr, T thetaBar=T()) const;
00372 
00374     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00375                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const;
00376 
00377 /* *************** Computation of macroscopic variables ********************* */
00380     virtual bool velIsJ() const;
00381 
00383     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00384 
00386     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00387 
00389     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00390                                   Array<T,Descriptor<T>::d>& u ) const;
00391 
00393     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00394 
00396     virtual void computeDeviatoricStress (
00397         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00398 
00400     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00401                                   Array<T,Descriptor<T>::d>& q ) const;
00402 
00404     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00405                                 plint momentId, T* moment ) const;
00406 
00407 /* *************** Switch between population and moment representation ****** */
00408 
00410     virtual plint numDecomposedVariables(plint order) const;
00411 
00413     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const;
00414 
00416     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const;
00417 
00419     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const;
00420     virtual void rescale(int dxScale, int dtScale) {
00421         Dynamics<T,Descriptor>::rescale(dxScale, dtScale);
00422     }
00423 
00424 /* *************** Additional moments, intended for internal use ************ */
00425 
00427     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00428 
00430     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00431                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00432 
00435     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00436                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00437                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00438 
00440     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00441 
00442 /* *************** Access to Dynamics variables, e.g. omega ***************** */
00443 
00445     virtual T getOmega() const;
00446 
00448     virtual void setOmega(T omega_);
00449 
00451     virtual T getParameter(plint whichParameter) const;
00452 
00454     virtual void setParameter(plint whichParameter, T value);
00455 
00456 /* *************** Access Cell raw data through Dynamics ********************* */
00457 
00459     virtual void getPopulations(Cell<T,Descriptor> const& cell, Array<T,Descriptor<T>::q>& f) const;
00460 
00462     virtual void getExternalField (
00463             Cell<T,Descriptor> const& cell, plint pos, plint size, T* ext ) const;
00464 
00466     virtual void setPopulations(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::q> const& f);
00467 
00469     virtual void setExternalField (
00470             Cell<T,Descriptor>& cell, plint pos, plint size, const T* ext);
00471 
00472 /* *************** Define macroscopic variables, e.g. on boundaries ********* */
00473 
00475     virtual void defineDensity(Cell<T,Descriptor>& cell, T density);
00476 
00478     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& u);
00479 
00481     virtual void defineTemperature(Cell<T,Descriptor>& cell, T temperature);
00482 
00484     virtual void defineHeatFlux(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& q);
00485 
00487     virtual void defineDeviatoricStress(Cell<T,Descriptor>& cell,
00488                                         Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq);
00489 
00491     virtual void defineMoment(Cell<T,Descriptor>& cell, plint momentId, T const* value);
00492 
00494     bool doesAutomaticPrepareCollision() const;
00495 
00497     void toggleAutomaticPrepareCollision(bool flag);
00498 private:
00499     Dynamics<T,Descriptor>* baseDynamics;
00500     bool automaticPrepareCollision;
00501 };
00502 
00504 
00508 template<typename T, template<typename U> class Descriptor>
00509 class PreparePopulationsDynamics : public CompositeDynamics<T,Descriptor> {
00510 public:
00511 /* *************** Construction and Destruction ***************************** */
00512     PreparePopulationsDynamics( Dynamics<T,Descriptor>* baseDynamics_,
00513                                 bool automaticPrepareCollision_=true );
00514     virtual void prepareCollision(Cell<T,Descriptor>& cell);
00515     virtual void completePopulations(Cell<T,Descriptor>& cell) const =0;
00516     virtual void serialize(HierarchicSerializer& serializer) const;
00517     virtual void unserialize(HierarchicUnserializer& unserializer);
00518     virtual PreparePopulationsDynamics<T,Descriptor>* clone() const =0;
00519 };
00520 
00521 
00523 
00526 template<typename T, template<typename U> class Descriptor>
00527 class BulkCompositeDynamics : public PreparePopulationsDynamics<T,Descriptor> {
00528 public:
00529 /* *************** Construction and Destruction ***************************** */
00530     BulkCompositeDynamics (Dynamics<T,Descriptor>* baseDynamics_,
00531                            bool automaticPrepareCollision_=true);
00532     virtual void serialize(HierarchicSerializer& serializer) const;
00533     virtual void unserialize(HierarchicUnserializer& unserializer);
00534 };
00535 
00536 
00538 
00545 template<typename T, template<typename U> class Descriptor>
00546 class BounceBack : public Dynamics<T,Descriptor> {
00547 public:
00548 /* *************** Construction / Destruction ******************************* */
00549 
00551     BounceBack(T rho_=T());
00552 
00554     virtual BounceBack<T,Descriptor>* clone() const;
00555 
00557     virtual int getId() const;
00558 
00560     virtual void serialize(HierarchicSerializer& serializer) const;
00562     virtual void unserialize(HierarchicUnserializer& unserializer);
00563 
00564 /* *************** Collision, Equilibrium, and Non-equilibrium ************** */
00565 
00567     virtual void collide(Cell<T,Descriptor>& cell,
00568                          BlockStatistics& statistics_);
00569 
00571     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00572                                  T jSqr, T thetaBar=T()) const;
00573 
00575     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00576                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const;
00577 
00578 /* *************** Computation of macroscopic variables ********************* */
00579 
00581     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00583     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00585     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00586                                   Array<T,Descriptor<T>::d>& u ) const;
00588     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00590     virtual void computeDeviatoricStress (
00591         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00593     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00594                                   Array<T,Descriptor<T>::d>& q ) const;
00595 
00597     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00598                                 plint momentId, T* moment ) const;
00599 
00600 /* *************** Access to Dynamics variables, e.g. omega ***************** */
00601 
00603     virtual T getOmega() const;
00604 
00606     virtual void setOmega(T omega_);
00607 
00608 /* *************** Switch between population and moment representation ****** */
00609 
00611     virtual plint numDecomposedVariables(plint order) const;
00612 
00614     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const;
00615 
00617     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const;
00618 
00620     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const;
00621     virtual void rescale(int dxScale, int dtScale) {
00622         Dynamics<T,Descriptor>::rescale(dxScale, dtScale);
00623     }
00624 
00626     virtual bool isBoundary() const;
00627 
00628 /* *************** Additional moments, intended for internal use ************ */
00629 
00631     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00632 
00634     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00635                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00636 
00639     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00640                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00641                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00642 
00644     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00645 private:
00646     T rho;
00647 private:
00648     static int id;
00649 };
00650 
00651 
00653 template<typename T, template<typename U> class Descriptor>
00654 class NoDynamics : public Dynamics<T,Descriptor> {
00655 public:
00656 /* *************** Construction / Destruction ******************************* */
00657     NoDynamics(T rho_=T());
00658 
00660     virtual NoDynamics<T,Descriptor>* clone() const;
00661 
00663     virtual int getId() const;
00664 
00666     virtual void serialize(HierarchicSerializer& serializer) const;
00668     virtual void unserialize(HierarchicUnserializer& unserializer);
00669 
00670 /* *************** Collision, Equilibrium, and Non-equilibrium ************** */
00671 
00673     virtual void collide(Cell<T,Descriptor>& cell,
00674                          BlockStatistics& statistics_);
00675 
00677     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00678                                  T jSqr, T thetaBar=T()) const;
00679 
00681     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00682                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const;
00683 
00684 /* *************** Computation of macroscopic variables ********************* */
00685 
00687     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00689     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00691     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00692                                   Array<T,Descriptor<T>::d>& u ) const;
00694     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00696     virtual void computeDeviatoricStress (
00697         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00699     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00700                                   Array<T,Descriptor<T>::d>& q ) const;
00701 
00703     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00704                                 plint momentId, T* moment ) const;
00705 
00706 /* *************** Access to Dynamics variables, e.g. omega ***************** */
00707 
00709     virtual T getOmega() const;
00710 
00712     virtual void setOmega(T omega_);
00713 
00714 /* *************** Switch between population and moment representation ****** */
00715 
00717     virtual plint numDecomposedVariables(plint order) const;
00718 
00720     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const;
00721 
00723     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const;
00724 
00726     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const;
00727     virtual void rescale(int dxScale, int dtScale) {
00728         Dynamics<T,Descriptor>::rescale(dxScale, dtScale);
00729     }
00730 
00731 /* *************** Additional moments, intended for internal use ************ */
00732 
00734     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00735 
00737     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00738                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00739 
00742     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00743                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00744                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00745 
00747     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00748 private:
00749     T rho;
00750 private:
00751     static int id;
00752 };
00753 
00755 template<typename T, template<typename U> class Descriptor>
00756 void constructIdChain(Dynamics<T,Descriptor> const& dynamics, std::vector<int>& chain);
00757 
00759 template<typename T, template<typename U> class Descriptor>
00760 Dynamics<T,Descriptor> const& getBottomMostDynamics(Dynamics<T,Descriptor> const& dynamics);
00761 
00764 template<typename T, template<typename U> class Descriptor>
00765 Dynamics<T,Descriptor>* cloneAndReplaceBottomDynamics(Dynamics<T,Descriptor> const& dynamics,
00766                                                       Dynamics<T,Descriptor>* newBottom);
00767 
00772 template<typename T, template<typename U> class Descriptor>
00773 Dynamics<T,Descriptor>* cloneAndInsertAtTopDynamics(Dynamics<T,Descriptor> const& dynamics,
00774                                                     CompositeDynamics<T,Descriptor>* newTop);
00775 
00778 template<typename T, template<typename U> class Descriptor>
00779 Dynamics<T,Descriptor>* removeBoundaryComponents(Dynamics<T,Descriptor> const& dynamics);
00780 
00783 template<typename T, template<typename U> class Descriptor>
00784 void serialize(Dynamics<T,Descriptor> const& dynamics, std::vector<char>& data);
00785 
00787 template<typename T, template<typename U> class Descriptor>
00788 void serialize(std::vector<Dynamics<T,Descriptor>*> const& dynamics, std::vector<char>& data);
00789 
00796 template<typename T, template<typename U> class Descriptor>
00797 pluint unserialize( Dynamics<T,Descriptor>& dynamics,
00798                     std::vector<char> const& data,
00799                     pluint serializerPos=0 );
00800 
00802 template<typename T, template<typename U> class Descriptor>
00803 void generateAndUnserializeDynamics (
00804         std::vector<char> const& data,
00805         std::vector<Dynamics<T,Descriptor>*>& dynamics);
00806 
00807 }  // namespace plb
00808 
00809 #endif  // DYNAMICS_H