/* This file is part of the OpenLB library
*
* Copyright (C) 2007, 2014 Mathias J. Krause
* E-mail contact: info@openlb.net
* The most recent release of OpenLB can be downloaded at
* <http://www.openlb.net/>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/** \file
* The description of a vector of 3D cuboid -- generic implementation.
*/
#ifndef CUBOID_GEOMETRY_3D_HH
#define CUBOID_GEOMETRY_3D_HH
#include <iostream>
#include <math.h>
#include <algorithm>
#include <set>
#include <limits>
#include "geometry/cuboidGeometry3D.h"
#include "functors/analytical/indicator/indicatorF3D.h"
#include "communication/loadBalancer.h"
namespace olb {
template<typename T>
CuboidGeometry3D<T>::CuboidGeometry3D()
: _motherCuboid(0,0,0,0,0,0,0), _periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
{
_cuboids.reserve(2);
add(_motherCuboid);
split(0, 1);
}
template<typename T>
CuboidGeometry3D<T>::CuboidGeometry3D(T originX, T originY, T originZ, T deltaR,
int nX, int nY, int nZ, int nC)
: _motherCuboid(originX, originY, originZ, deltaR, nX, nY, nZ),
_periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
{
_cuboids.reserve(nC+2);
add(_motherCuboid);
split(0, nC);
}
template<typename T>
CuboidGeometry3D<T>::CuboidGeometry3D(std::vector<T> origin, T deltaR,
std::vector<int> extent, int nC)
: CuboidGeometry3D(origin[0], origin[1], origin[2], deltaR,
extent[0], extent[1], extent[2], nC)
{
_cuboids.reserve(nC+2);
}
template<typename T>
CuboidGeometry3D<T>::CuboidGeometry3D(IndicatorF3D<T>& indicatorF, T voxelSize, int nC)
: _motherCuboid( indicatorF.getMin()[0], indicatorF.getMin()[1], indicatorF.getMin()[2], voxelSize,
(int)((indicatorF.getMax()[0] - indicatorF.getMin()[0]) / voxelSize + 1.5),
(int)((indicatorF.getMax()[1] - indicatorF.getMin()[1]) / voxelSize + 1.5),
(int)((indicatorF.getMax()[2] - indicatorF.getMin()[2]) / voxelSize + 1.5)),
_periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
{
_cuboids.reserve(