/usr/include/paraview/CartesianDecomp.h is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | /*
* Copyright 2012 SciberQuest Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither name of SciberQuest Inc. nor the names of any contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CartesianDecomp_h
#define CartesianDecomp_h
#include "RefCountedPointer.h" // for RefCountedPointer
#include "CartesianExtent.h" // for CartesianExtent
#include "CartesianBounds.h" // for CartesianBounds
#include <vector> // for vector
class CartesianDataBlock;
class CartesianDataBlockIODescriptor;
/// Splits a cartesian grid into a set of smaller cartesian grids.
/**
Splits a cartesian grid into a set of smaller cartesian grids using
a set of axis aligned planes. Given a point will locate and return
the sub-grid which contains it.
*/
class CartesianDecomp : public RefCountedPointer
{
public:
//static CartesianDecomp *New(){ return new CartesianDecomp; }
/**
Set the index space of the data on disk.
*/
void SetFileExtent(int ilo,int ihi,int jlo,int jhi,int klo,int khi);
void SetFileExtent(const int ext[6]);
void SetFileExtent(const CartesianExtent &ext);
CartesianExtent &GetFileExtent(){ return this->FileExtent; }
const CartesianExtent &GetFileExtent() const { return this->FileExtent; }
/**
Determine from fileExtent and number of Ghosts the dimension
of the dataset.
*/
void ComputeDimensionMode();
/**
Get/Set the physical bounds of the entire decomposition.
*/
void SetBounds(
double xlo,
double xhi,
double ylo,
double yhi,
double zlo,
double zhi);
void SetBounds(const double bounds[6]);
void SetBounds(const CartesianBounds &bounds);
CartesianBounds &GetBounds(){ return this->Bounds; }
const CartesianBounds &GetBounds() const { return this->Bounds; }
/**
Set the index space of the decomposition.
*/
void SetExtent(int ilo,int ihi,int jlo,int jhi,int klo,int khi);
void SetExtent(const int ext[6]);
void SetExtent(const CartesianExtent &ext);
CartesianExtent &GetExtent(){ return this->Extent; }
const CartesianExtent &GetExtent() const { return this->Extent; }
/**
Get the dimension of the decompostion in each direction.
*/
int SetDecompDims(int nBlocks);
int SetDecompDims(int ni, int nj, int nk);
int SetDecompDims(const int decompDims[3]);
int *GetDecompDimensions(){ return this->DecompDims; }
const int *GetDecompDimensions() const { return this->DecompDims; }
/**
Set the periodic boundary flags.
*/
void SetPeriodicBC(int pi, int pj, int pk);
void SetPeriodicBC(const int periodic[3]);
int *GetPeriodicBC(){ return this->PeriodicBC; }
const int *GetPeriodicBC() const { return this->PeriodicBC; }
/**
Set the number of ghost cells each block will have.
*/
void SetNumberOfGhostCells(int n){ this->NGhosts=n; }
int GetNumberOfGhostCells() const { return this->NGhosts; }
/**
Decompose the domain in to the requested number of blocks.
*/
// virtual int DecomposeDomain()=0;
/**
Find and return the block which contains a given point.
If no block contains the point null is returned.
*/
CartesianDataBlock *GetBlock(const double *pt);
/**
Get the block at the tuple (i,j,k).
*/
const CartesianDataBlock *GetBlock(const int *I) const
{
return this->GetBlock(I[0],I[1],I[2]);
}
CartesianDataBlock *GetBlock(const int *I)
{
return
const_cast<CartesianDataBlock *>(
static_cast<const CartesianDecomp*>(this)->GetBlock(I[0],I[1],I[2]));
}
const CartesianDataBlock *GetBlock(int i, int j, int k) const
{
const int nij=this->DecompDims[3];
const int ni=this->DecompDims[0];
const int idx=k*nij+j*ni+i;
return this->Decomp[idx];
}
CartesianDataBlock *GetBlock(int i, int j, int k)
{
return
const_cast<CartesianDataBlock *>(
static_cast<const CartesianDecomp*>(this)->GetBlock(i,j,k));
}
/**
Return the block at the given flat index.
*/
CartesianDataBlock *GetBlock(int idx){ return this->Decomp[idx]; }
const CartesianDataBlock *GetBlock(int idx) const { return this->Decomp[idx]; }
/**
Return the io descriptor at the given flat index.
*/
CartesianDataBlockIODescriptor *GetBlockIODescriptor(int idx)
{
return this->IODescriptors[idx];
}
const CartesianDataBlockIODescriptor *GetBlockIODescriptor(int idx) const
{
return this->IODescriptors[idx];
}
/**
Get the array of blocks.
*/
// CartesianDataBlock **GetBlocks(){ return &this->Decomp[0]; }
// const CartesianDataBlock * const *GetBlocks() const { return &this->Decomp[0]; }
/**
Get the number of blocks.
*/
size_t GetNumberOfBlocks() const { return this->Decomp.size(); }
/**
Convert an id tuple into an index.
*/
int BlockIdToIndex(const int *I) const
{
const int nij=this->DecompDims[3];
const int ni=this->DecompDims[0];
const int idx=I[2]*nij+I[1]*ni+I[0];
return idx;
}
private:
void operator=(CartesianDecomp &); // not implemented
CartesianDecomp(CartesianDecomp &); // not implemented
protected:
CartesianDecomp();
virtual ~CartesianDecomp();
/**
Release decomposition resources.
*/
virtual void ClearDecomp();
virtual void ClearIODescriptors();
protected:
int Mode; // 2d xy,xz,yz, or 3d
int NGhosts; // number of ghost cells.
int PeriodicBC[3]; // boolean set if periodic boundary in the direction
int DecompDims[4]; // block array size (ni,nj,nk,ni*nj)
std::vector<CartesianDataBlock *> Decomp; // block array
std::vector<CartesianDataBlockIODescriptor *> IODescriptors;
CartesianBounds Bounds; // domain world space bounds
CartesianExtent Extent; // domain index space bounds
CartesianExtent FileExtent; // extent of all data on disk
};
#endif
// VTK-HeaderTest-Exclude: CartesianDecomp.h
|