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

offLatticeModel3D.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 #ifndef OFF_LATTICE_MODEL_3D_H
00026 #define OFF_LATTICE_MODEL_3D_H
00027 
00028 #include "core/globalDefs.h"
00029 
00030 namespace plb {
00031 
00032 template< typename T, class SurfaceData >
00033 class OffLatticeModel3D {
00034 public:
00035     OffLatticeModel3D(BoundaryShape3D<T,SurfaceData>* shape_, int flowType_);
00036     OffLatticeModel3D(OffLatticeModel3D<T,SurfaceData> const& rhs);
00037     OffLatticeModel3D<T,SurfaceData>& operator= (
00038             OffLatticeModel3D<T,SurfaceData> const& rhs );
00039     virtual ~OffLatticeModel3D();
00040     void provideShapeArguments(std::vector<AtomicBlock3D*> args);
00041     plint getTag(plint id) const;
00042     bool pointOnSurface (
00043             Dot3D const& fromPoint, Dot3D const& direction,
00044             Array<T,3>& locatedPoint, T& distance,
00045             Array<T,3>& wallNormal, SurfaceData& surfaceData,
00046             OffBoundary::Type& bdType, plint& id ) const;
00047     Array<T,3> computeContinuousNormal (
00048             Array<T,3> const& p, plint id, bool isAreaWeighted = false ) const;
00049     bool intersectsSurface (
00050             Dot3D const& p1, Dot3D const& p2, plint& id ) const;
00051     bool isFluid(Dot3D const& location) const;
00052     bool velIsJ() const { return velIsJflag; }
00053     void setVelIsJ(bool velIsJflag_) { velIsJflag = velIsJflag_; }
00054     bool getPartialReplace() const { return partialReplaceFlag; }
00055     void setPartialReplace(bool prFlag) { partialReplaceFlag = prFlag; }
00056     virtual OffLatticeModel3D<T,SurfaceData>* clone() const =0;
00057     virtual plint getNumNeighbors() const =0;
00058     virtual void prepareCell (
00059             Dot3D const& cellLocation, AtomicContainerBlock3D& container ) =0;
00060     virtual void boundaryCompletion (
00061             AtomicBlock3D& lattice,
00062             AtomicContainerBlock3D& container,
00063             std::vector<AtomicBlock3D const*> const& args ) =0;
00064     virtual ContainerBlockData* generateOffLatticeInfo() const =0;
00065     virtual Array<T,3> getLocalForce(AtomicContainerBlock3D& container) const =0;
00066 private:
00067     BoundaryShape3D<T,SurfaceData>* shape;
00068     int flowType;
00069     bool velIsJflag;
00070     bool partialReplaceFlag;
00071 };
00072 
00075 template<typename T, class SurfaceData>
00076 class OffLatticePatternFunctional3D : public BoxProcessingFunctional3D
00077 {
00078 public:
00081     OffLatticePatternFunctional3D (
00082             OffLatticeModel3D<T,SurfaceData>* offLatticeModel_ );
00083     virtual ~OffLatticePatternFunctional3D();
00084     OffLatticePatternFunctional3D(OffLatticePatternFunctional3D const& rhs);
00085     OffLatticePatternFunctional3D& operator= (
00086             OffLatticePatternFunctional3D const& rhs );
00087     void swap(OffLatticePatternFunctional3D& rhs);
00088     virtual OffLatticePatternFunctional3D<T,SurfaceData>* clone() const;
00089 
00093     virtual void processGenericBlocks(Box3D domain, std::vector<AtomicBlock3D*> fields);
00094     virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const;
00095     virtual BlockDomain::DomainT appliesTo() const;
00096 private:
00097     OffLatticeModel3D<T,SurfaceData>* offLatticeModel;
00098 };
00099 
00100 template<typename T, template<typename U> class Descriptor, class SurfaceData>
00101 class OffLatticeCompletionFunctional3D : public BoxProcessingFunctional3D
00102 {
00103 public:
00104     OffLatticeCompletionFunctional3D (
00105             OffLatticeModel3D<T,SurfaceData>* offLatticeModel_,
00106             plint numShapeArgs_, plint numCompletionArgs_ );
00107     virtual ~OffLatticeCompletionFunctional3D();
00108     OffLatticeCompletionFunctional3D(OffLatticeCompletionFunctional3D<T,Descriptor,SurfaceData> const& rhs);
00109     OffLatticeCompletionFunctional3D& operator= (
00110             OffLatticeCompletionFunctional3D<T,Descriptor,SurfaceData> const& rhs );
00111     void swap(OffLatticeCompletionFunctional3D<T,Descriptor,SurfaceData>& rhs);
00112 
00117     virtual void processGenericBlocks(Box3D domain, std::vector<AtomicBlock3D*> fields);
00118     virtual OffLatticeCompletionFunctional3D<T,Descriptor,SurfaceData>* clone() const;
00119     virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const;
00120     virtual BlockDomain::DomainT appliesTo() const;
00121 private:
00122     OffLatticeModel3D<T,SurfaceData>* offLatticeModel;
00123     plint numShapeArgs, numCompletionArgs;
00124 };
00125 
00126 template< typename T, class SurfaceData >
00127 class GetForceOnObjectFunctional3D : public PlainReductiveBoxProcessingFunctional3D
00128 {
00129 public:
00130     GetForceOnObjectFunctional3D (
00131             OffLatticeModel3D<T,SurfaceData>* offLatticeModel_ );
00132     virtual ~GetForceOnObjectFunctional3D();
00133     GetForceOnObjectFunctional3D(GetForceOnObjectFunctional3D<T,SurfaceData> const& rhs);
00134     GetForceOnObjectFunctional3D<T,SurfaceData>& operator= (
00135             GetForceOnObjectFunctional3D<T,SurfaceData> const& rhs );
00136 
00138     virtual void processGenericBlocks(Box3D domain, std::vector<AtomicBlock3D*> fields);
00139     virtual GetForceOnObjectFunctional3D<T,SurfaceData>* clone() const;
00140     virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const;
00141     virtual BlockDomain::DomainT appliesTo() const;
00142     Array<T,3> getForce() const;
00143 private:
00144     OffLatticeModel3D<T,Array<T,3> >* offLatticeModel;
00145     Array<plint,3> forceId;
00146 };
00147 
00148 }  // namespace plb
00149 
00150 #endif  // OFF_LATTICE_MODEL_3D_H