$treeview $search $mathjax
|
Palabos
Version 1.1
$projectbrief
|
$projectbrief
|
$searchbox |
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 BOUNDARY_SHAPES_3D_H 00026 #define BOUNDARY_SHAPES_3D_H 00027 00028 #include "core/globalDefs.h" 00029 #include "atomicBlock/atomicBlock3D.h" 00030 #include "core/geometry3D.h" 00031 #include "core/array.h" 00032 00033 namespace plb { 00034 00035 struct OffBoundary { 00036 enum Type {dirichlet, neumann, freeSlip, constRhoInlet, densityNeumann, flux, isolation}; 00037 }; 00038 00040 template<typename T, class SurfaceData> 00041 struct BoundaryShape3D { 00042 virtual ~BoundaryShape3D() { } 00044 00052 virtual bool isInside(Dot3D const& location) const =0; 00062 virtual bool pointOnSurface ( 00063 Array<T,3> const& fromPoint, Array<T,3> const& direction, 00064 Array<T,3>& locatedPoint, T& distance, 00065 Array<T,3>& wallNormal, SurfaceData& surfaceData, 00066 OffBoundary::Type& bdType, plint& id ) const =0; 00076 virtual bool gridPointOnSurface ( 00077 Dot3D const& fromPoint, Dot3D const& direction, 00078 Array<T,3>& locatedPoint, T& distance, 00079 Array<T,3>& wallNormal, SurfaceData& surfaceData, 00080 OffBoundary::Type& bdType, plint& id ) const 00081 { 00082 return pointOnSurface(Array<T,3>((T)fromPoint.x, (T)fromPoint.y, (T)fromPoint.z), 00083 Array<T,3>((T)direction.x, (T)direction.y, (T)direction.z), 00084 locatedPoint, distance, wallNormal, surfaceData, bdType, id); 00085 } 00089 virtual Array<T,3> computeContinuousNormal ( 00090 Array<T,3> const& p, plint id, bool isAreaWeighted = false ) const =0; 00092 virtual bool intersectsSurface ( 00093 Array<T,3> const& p1, Array<T,3> const& p2, plint& id ) const =0; 00095 virtual bool gridIntersectsSurface ( 00096 Dot3D const& p1, Dot3D const& p2, plint& id ) const 00097 { 00098 return intersectsSurface( Array<T,3>((T)p1.x, (T)p1.y, (T)p1.z), 00099 Array<T,3>((T)p2.x, (T)p2.y, (T)p2.z), id ); 00100 } 00104 virtual bool distanceToSurface( Array<T,3> const& point, 00105 T& distance, bool& isBehind ) const =0; 00109 virtual bool gridDistanceToSurface( Dot3D const& point, 00110 T& distance, bool& isBehind ) const 00111 { 00112 return distanceToSurface( Array<T,3>((T)point.x, (T)point.y, (T)point.z), 00113 distance, isBehind ); 00114 } 00117 virtual plint getTag(plint id) const =0; 00119 virtual BoundaryShape3D<T,SurfaceData>* clone() const =0; 00122 virtual BoundaryShape3D<T,SurfaceData>* clone(std::vector<AtomicBlock3D*> args) const { 00123 return clone(); 00124 } 00125 }; 00126 00127 template<typename T, class SurfaceData> 00128 class BoundaryShapeIntersection3D : public BoundaryShape3D<T,SurfaceData> { 00129 public: 00130 BoundaryShapeIntersection3D(); 00131 virtual ~BoundaryShapeIntersection3D(); 00132 BoundaryShapeIntersection3D(BoundaryShapeIntersection3D<T,SurfaceData> const& rhs); 00133 BoundaryShapeIntersection3D<T,SurfaceData>& operator=(BoundaryShapeIntersection3D<T,SurfaceData> const& rhs); 00134 void swap(BoundaryShapeIntersection3D<T,SurfaceData>& rhs); 00135 void addComponent(BoundaryShape3D<T,SurfaceData>* component); 00136 00137 virtual bool isInside(Array<T,3> const& location) const; 00138 virtual bool isInside(Array<T,3> const& location, T epsilon) const; 00139 virtual bool pointOnSurface ( 00140 Array<T,3> const& fromPoint, Array<T,3> const& direction, 00141 Array<T,3>& locatedPoint, T& distance, 00142 Array<T,3>& wallNormal, SurfaceData& surfaceData, 00143 OffBoundary::Type& bdType, plint& id ) const; 00144 virtual bool intersectsSurface ( 00145 Array<T,3> const& p1, Array<T,3> const& p2, plint& id ) const; 00146 virtual bool distanceToSurface( Array<T,3> const& point, 00147 T& distance, bool& isBehind ) const; 00148 virtual plint getTag(plint id) const; 00149 virtual BoundaryShapeIntersection3D<T,SurfaceData>* clone() const; 00150 private: 00151 std::vector<BoundaryShape3D<T,SurfaceData>*> components; 00152 }; 00153 00154 } // namespace plb 00155 00156 #endif // BOUNDARY_SHAPES_3D_H
1.6.3
1.6.3