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

triangleHash.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 TRIANGLE_HASH_H
00026 #define TRIANGLE_HASH_H
00027 
00028 #include "core/globalDefs.h"
00029 #include "atomicBlock/dataProcessingFunctional3D.h"
00030 #include "atomicBlock/dataField3D.h"
00031 #include "atomicBlock/atomicContainerBlock3D.h"
00032 #include "multiBlock/multiContainerBlock3D.h"
00033 #include "multiBlock/multiDataField3D.h"
00034 #include "particles/particleField3D.h"
00035 
00036 namespace plb {
00037 
00038 template<typename T>
00039 class TriangleHash {
00040 public:
00041     TriangleHash(AtomicContainerBlock3D& hashContainer);
00042     void assignTriangles(TriangularSurfaceMesh<T> const& mesh);
00043     void bruteReAssignTriangles(TriangularSurfaceMesh<T> const& mesh);
00044     template<class ParticleFieldT>
00045     void reAssignTriangles (
00046             TriangularSurfaceMesh<T> const& mesh, ParticleFieldT& particles,
00047             std::vector<plint> const& nonParallelVertices );
00048     void getTriangles (
00049             Array<T,2> const& xRange,
00050             Array<T,2> const& yRange,
00051             Array<T,2> const& zRange,
00052             std::vector<plint>& foundTriangles ) const;
00053     void getTriangles (
00054             Box3D const& domain,
00055             std::vector<plint>& foundTriangles ) const;
00056 private:
00057     ScalarField3D<std::vector<plint> >& triangles;
00058     std::vector<Dot3D>& assignedPositions;
00059 };
00060 
00061 template<typename T>
00062 class CreateTriangleHash : public BoxProcessingFunctional3D {
00063 public:
00064     CreateTriangleHash (
00065             TriangularSurfaceMesh<T> const& mesh_ );
00066     // Field 0: Hash.
00067     virtual void processGenericBlocks (
00068                 Box3D domain, std::vector<AtomicBlock3D*> fields );
00069     virtual CreateTriangleHash<T>* clone() const;
00070     virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const;
00071     virtual BlockDomain::DomainT appliesTo() const;
00072 private:
00073     TriangularSurfaceMesh<T> const& mesh;
00074 };
00075 
00076 template<typename T, class ParticleFieldT>
00077 class ReAssignTriangleHash : public BoxProcessingFunctional3D {
00078 public:
00079     // The triangle hash includes the possibilities for triangles
00080     //   which are too big for proper parallelization, such as, inlet
00081     //   or outlet triangles. The vertices of these triangles must be
00082     //   non-parallel, which means, well defined on each processor. The
00083     //   argument nonParallelVertices must enumerate at least one vertex
00084     //   of each non-parallel triangle. It is a requirement that all
00085     //   vertices of all triangles connected to the vertices listed in
00086     //   nonParallelVertices are non-parallel, i.e. define on each
00087     //   processor.
00088     ReAssignTriangleHash (
00089             TriangularSurfaceMesh<T> const& mesh_,
00090             std::vector<plint> const& nonParallelVertices_ );
00091     // Field 0: Hash; Field 1: Particles.
00092     virtual void processGenericBlocks (
00093                 Box3D domain, std::vector<AtomicBlock3D*> fields );
00094     virtual ReAssignTriangleHash<T,ParticleFieldT>* clone() const;
00095     virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const;
00096     virtual BlockDomain::DomainT appliesTo() const;
00097 private:
00098     TriangularSurfaceMesh<T> const& mesh;
00099     std::vector<plint> nonParallelVertices;
00100 };
00101 
00102 template<typename T>
00103 class BruteReAssignTriangleHash : public BoxProcessingFunctional3D {
00104 public:
00105     BruteReAssignTriangleHash (
00106             TriangularSurfaceMesh<T> const& mesh_ );
00107     // Field 0: Hash.
00108     virtual void processGenericBlocks (
00109                 Box3D domain, std::vector<AtomicBlock3D*> fields );
00110     virtual BruteReAssignTriangleHash<T>* clone() const;
00111     virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const;
00112     virtual BlockDomain::DomainT appliesTo() const;
00113 private:
00114     TriangularSurfaceMesh<T> const& mesh;
00115 };
00116 
00117 
00118 }  // namespace plb
00119 
00120 #endif  // TRIANGLE_HASH_H
00121