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

multiBlockManagement2D.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 MULTI_BLOCK_MANAGEMENT_2D_H
00030 #define MULTI_BLOCK_MANAGEMENT_2D_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "core/geometry2D.h"
00034 #include "multiBlock/threadAttribution.h"
00035 #include "multiBlock/sparseBlockStructure2D.h"
00036 #include "multiBlock/localMultiBlockInfo2D.h"
00037 #include <vector>
00038 
00039 
00040 namespace plb {
00041 
00042 class MultiBlockManagement2D {
00043 public:
00044     MultiBlockManagement2D( SparseBlockStructure2D const& sparseBlock_,
00045                             ThreadAttribution* threadAttribution_,
00046                             plint envelopeWidth_,
00047                             plint refinementLevel_ =0 );
00048     MultiBlockManagement2D(MultiBlockManagement2D const& rhs);
00049     MultiBlockManagement2D& operator=(MultiBlockManagement2D const& rhs);
00050     void swap(MultiBlockManagement2D& rhs);
00051     ~MultiBlockManagement2D();
00052     plint getEnvelopeWidth() const;
00053     Box2D getBoundingBox() const;
00054     Box2D getBulk(plint blockId) const;
00055     Box2D getUniqueBulk(plint blockId) const;
00056     Box2D getEnvelope(plint blockId) const;
00057     SparseBlockStructure2D const& getSparseBlockStructure() const;
00058     LocalMultiBlockInfo2D const& getLocalInfo() const;
00059     ThreadAttribution const& getThreadAttribution() const;
00060     bool findInLocalBulk (
00061             plint iX, plint iY, plint& foundId,
00062             plint& localX, plint& localY ) const;
00063     bool findAllLocalRepresentations (
00064             plint iX, plint iY, std::vector<plint>& foundId,
00065             std::vector<plint>& foundX, std::vector<plint>& foundY ) const;
00066     plint getRefinementLevel() const;
00067     void setRefinementLevel(plint newLevel);
00068 private:
00069     plint                  envelopeWidth;
00070     SparseBlockStructure2D sparseBlock;
00071     ThreadAttribution*     threadAttribution;
00072     LocalMultiBlockInfo2D  localInfo;
00073     plint                  refinementLevel;
00074 };
00075 
00077 
00081 MultiBlockManagement2D intersect (
00082         MultiBlockManagement2D const& originalManagement,
00083         Box2D subDomain, bool crop );
00084 
00086 MultiBlockManagement2D intersect (
00087         MultiBlockManagement2D const& originalManagement,
00088         Box2D subDomain, Box2D newBoundingBox );
00089 
00091 
00095 MultiBlockManagement2D intersect( MultiBlockManagement2D const& management1,
00096                                   MultiBlockManagement2D const& management2, bool crop );
00097 
00099 
00101 MultiBlockManagement2D extend( MultiBlockManagement2D const& management,
00102                                Box2D addedBulk, Box2D addedUniqueBulk );
00103 
00105 MultiBlockManagement2D except( MultiBlockManagement2D const& management,
00106                                Box2D exceptedBlock );
00107 
00109 
00112 MultiBlockManagement2D block_union( MultiBlockManagement2D const& management1,
00113                                     MultiBlockManagement2D const& management2 );
00114 
00117 MultiBlockManagement2D align( MultiBlockManagement2D const& originalManagement,
00118                               MultiBlockManagement2D const& partnerManagement );
00119 
00121 
00123 MultiBlockManagement2D reparallelize(MultiBlockManagement2D const& management,
00124                                      plint blockLx, plint blockLy);
00125 
00127 class SmartBulk2D {
00128 public:
00130     SmartBulk2D( MultiBlockManagement2D const& management,
00131                  plint blockId );
00133     SmartBulk2D( SparseBlockStructure2D const& sparseBlock_,
00134                  plint envelopeWidth_, plint blockId );
00135     SmartBulk2D( SparseBlockStructure2D const& sparseBlock_,
00136                  plint envelopeWidth_, Box2D const& bulk_ );
00138     Box2D getBulk() const;
00140     Box2D computeEnvelope() const;
00142     Box2D computeNonPeriodicEnvelope() const;
00144     Box2D toLocal(Box2D const& coord) const;
00146     plint toLocalX(plint iX) const;
00148     plint toLocalY(plint iY) const;
00149 private:
00150     SparseBlockStructure2D const& sparseBlock;
00151     plint envelopeWidth;
00152     Box2D bulk;
00153 };
00154 
00155 }  // namespace plb
00156 
00157 #endif  // MULTI_BLOCK_MANAGEMENT_2D_H