4#include "tree_constants.hpp"
43void Map::initialize(){
51void Map::initialize(uint8_t dim){
63 m_nnodes = treeConstants.nNodes;
64 m_nnodesPerFace = treeConstants.nNodesPerFace;
66 m_maxLength = treeConstants.lengths[0];
67 m_maxArea = treeConstants.areas[0];
68 m_maxVolume = treeConstants.volumes[0];
70 m_maxLength_1 = 1. / double(m_maxLength);
71 m_maxArea_1 = 1. / double(m_maxArea);
72 m_maxVolume_1 = 1. / double(m_maxVolume);
81 m_maxLength_1 = std::numeric_limits<double>::infinity();
82 m_maxArea_1 = std::numeric_limits<double>::infinity();
83 m_maxVolume_1 = std::numeric_limits<double>::infinity();
92darray3 Map::mapCoordinates(u32array3
const & X)
const {
94 for (
int i=0; i<3; ++i){
95 coords[i] = m_maxLength_1 * double(X[i]);
104double Map::mapX(uint32_t X)
const {
105 return m_maxLength_1 * double(X);
112double Map::mapY(uint32_t Y)
const {
113 return m_maxLength_1 * double(Y);
120double Map::mapZ(uint32_t Z)
const {
121 return m_maxLength_1 * double(Z);
128u32array3 Map::mapCoordinates(darray3
const & X)
const {
129 u32array3 coords = {{0, 0, 0}};
130 for (
int i=0; i<3; ++i){
131 coords[i] = (uint32_t)(
double(m_maxLength) * X[i]);
140uint32_t Map::mapX(
double X)
const {
141 return (uint32_t)(double(m_maxLength) * X);
148uint32_t Map::mapY(
double Y)
const {
149 return (uint32_t)(double(m_maxLength) * Y);
156uint32_t Map::mapZ(
double Z)
const {
157 return (uint32_t)(double(m_maxLength) * Z);
164double Map::mapSize(uint32_t size)
const {
165 return m_maxLength_1 *double(size);
172double Map::mapArea(uint64_t area)
const {
173 return m_maxArea_1*double(area);
180double Map::mapVolume(uint64_t volume)
const {
181 return m_maxVolume_1*double(volume);
188void Map::mapCenter(
double* & center, darray3 & mapcenter)
const {
189 for (
int i=0; i<3; i++){
190 mapcenter[i] = m_maxLength_1 * center[i];
198void Map::mapCenter(darray3 & center, darray3 & mapcenter)
const {
199 for (
int i=0; i<3; i++){
200 mapcenter[i] = m_maxLength_1 * center[i];
208void Map::mapNodes(uint32_t (*nodes)[3], darr3vector & mapnodes)
const {
209 mapnodes.resize(m_nnodes);
210 for (
int i=0; i<m_nnodes; i++){
211 for (
int j=0; j<3; j++){
212 mapnodes[i][j] = m_maxLength_1 * double(nodes[i][j]);
221void Map::mapNodes(u32arr3vector nodes, darr3vector & mapnodes)
const {
222 mapnodes.resize(m_nnodes);
223 for (
int i=0; i<m_nnodes; i++){
224 for (
int j=0; j<3; j++){
225 mapnodes[i][j] = m_maxLength_1 * double(nodes[i][j]);
234void Map::mapNode(u32array3 & node, darray3 & mapnode)
const {
235 for (
int j=0; j<3; j++){
236 mapnode[j] = m_maxLength_1 * double(node[j]);
244void Map::mapNodesIntersection(uint32_t (*nodes)[3], darr3vector & mapnodes)
const {
245 mapnodes.resize(m_nnodesPerFace);
246 for (
int i=0; i<m_nnodesPerFace; i++){
247 for (
int j=0; j<3; j++){
248 mapnodes[i][j] = m_maxLength_1 * double(nodes[i][j]);
257void Map::mapNodesIntersection(u32arr3vector nodes, darr3vector & mapnodes)
const {
258 mapnodes.resize(m_nnodesPerFace);
259 for (
int i=0; i<m_nnodesPerFace; i++){
260 for (
int j=0; j<3; j++){
261 mapnodes[i][j] = m_maxLength_1 * double(nodes[i][j]);
270void Map::mapNormals(i8array3 normal, darray3 & mapnormal)
const {
271 mapnormal[0] = double(normal[0]);
272 mapnormal[1] = double(normal[1]);
273 mapnormal[2] = double(normal[2]);
static BITPIT_PUBLIC_API const TreeConstants & instance(uint8_t dim)