# PhasicFlow: utilities/postprocessPhasicFlow/rectangleMesh.hpp Source File

rectangleMesh.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __rectangleMesh_hpp__
#define __rectangleMesh_hpp__
#include "cells.hpp"
namespace pFlow
{
class rectangleMesh
:
public cells<int32>
{
public:
TypeInfoNV("rectangleMesh");
INLINE_FUNCTION_HD
rectangleMesh(){};
INLINE_FUNCTION_HD
rectangleMesh(
const realx3& minP,
const realx3& maxP,
int32 nx,
int32 ny,
int32 nz)
:
cells(
box(minP, maxP),
nx, ny, nz)
{}
INLINE_FUNCTION_H
rectangleMesh(const dictionary & dict)
:
cells(
box(
dict.getVal<realx3>("min"),
dict.getVal<realx3>("max")),
dict.getVal<int32>("nx"),
dict.getVal<int32>("ny"),
dict.getVal<int32>("nz")
)
{}
INLINE_FUNCTION_HD
rectangleMesh(const rectangleMesh&) = default;
INLINE_FUNCTION_HD
rectangleMesh& operator = (const rectangleMesh&) = default;
INLINE_FUNCTION_HD
rectangleMesh(rectangleMesh&&) = default;
INLINE_FUNCTION_HD
rectangleMesh& operator = (rectangleMesh&&) = default;
INLINE_FUNCTION_HD
~rectangleMesh() = default;
INLINE_FUNCTION_HD
int64 size()const
{
return this->totalCells();
}
INLINE_FUNCTION_HD
real cellVol()const
{
auto [dx,dy,dz] = this->cellSize();
return dx*dy*dz;
}
INLINE_FUNCTION_H
auto minPoint()const
{
return domain().minPoint();
}
INLINE_FUNCTION_H
auto maxPoint()const
{
return domain().maxPoint();
}
bool read(iIstream& is)
{
return true;
}
bool write(iOstream& os)const
{
return true;
}
bool writeToVtk(iOstream& os)const
{
os<<"DATASET RECTILINEAR_GRID"<<endl;
os<<"DIMENSIONS "<<nx()+1<<" "<< ny()+1 << " "<< nz()+1 <<endl;
auto [x, y , z] = this->minPoint();
auto [dx, dy, dz] = this->cellSize();
os<<"X_COORDINATES "<< nx()+1 <<" float\n";
for(int32 i=0; i<nx()+1; i++)
{
os<< x<<"\n";
x+= dx;
}
os<<"Y_COORDINATES "<< ny()+1 <<" float\n";
for(int32 j=0; j<ny()+1; j++)
{
os<< y <<"\n";
y+= dy;
}
os<<"Z_COORDINATES "<< nz()+1 <<" float\n";
for(int32 j=0; j<nz()+1; j++)
{
os<< z <<"\n";
z+= dz;
}
os<<"CELL_DATA "<< nx()*ny()*nz()<<endl;
return true;
}
};
}
#endif // __rectangleMesh_hpp__
pFlow::cells< int32 >::nz
INLINE_FUNCTION_HD int32 nz() const
Definition: cells.hpp:139
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::rectangleMesh::rectangleMesh
INLINE_FUNCTION_H rectangleMesh(const dictionary &dict)
Definition: rectangleMesh.hpp:58
pFlow::rectangleMesh::operator=
INLINE_FUNCTION_HD rectangleMesh & operator=(const rectangleMesh &)=default
pFlow::rectangleMesh::rectangleMesh
INLINE_FUNCTION_HD rectangleMesh()
Definition: rectangleMesh.hpp:42
pFlow::rectangleMesh::writeToVtk
bool writeToVtk(iOstream &os) const
Definition: rectangleMesh.hpp:121
pFlow::int64
long long int int64
Definition: builtinTypes.hpp:55
pFlow::cells< int32 >::nx
INLINE_FUNCTION_HD int32 nx() const
Definition: cells.hpp:127
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::rectangleMesh::minPoint
INLINE_FUNCTION_H auto minPoint() const
Definition: rectangleMesh.hpp:100
pFlow::rectangleMesh
Definition: rectangleMesh.hpp:31
pFlow
Definition: demComponent.hpp:28
pFlow::rectangleMesh::~rectangleMesh
INLINE_FUNCTION_HD ~rectangleMesh()=default
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::cells< int32 >::domain
const auto & domain() const
Definition: cells.hpp:152
pFlow::rectangleMesh::write
bool write(iOstream &os) const
Definition: rectangleMesh.hpp:116
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
cells.hpp
pFlow::rectangleMesh::read
bool read(iIstream &is)
Definition: rectangleMesh.hpp:111
pFlow::rectangleMesh::cellVol
INLINE_FUNCTION_HD real cellVol() const
Definition: rectangleMesh.hpp:93
pFlow::rectangleMesh::rectangleMesh
INLINE_FUNCTION_HD rectangleMesh(const realx3 &minP, const realx3 &maxP, int32 nx, int32 ny, int32 nz)
Definition: rectangleMesh.hpp:45
pFlow::rectangleMesh::TypeInfoNV
TypeInfoNV("rectangleMesh")
pFlow::box
Definition: box.hpp:32
pFlow::cells< int32 >::ny
INLINE_FUNCTION_HD int32 ny() const
Definition: cells.hpp:133
pFlow::cells< int32 >::cellSize
INLINE_FUNCTION_HD realx3 cellSize() const
Definition: cells.hpp:115
pFlow::cells
Definition: cells.hpp:32
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::cells< int32 >::totalCells
INLINE_FUNCTION_HD int64 totalCells() const
Definition: cells.hpp:145
pFlow::rectangleMesh::size
INLINE_FUNCTION_HD int64 size() const
Definition: rectangleMesh.hpp:87
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::rectangleMesh::maxPoint
INLINE_FUNCTION_H auto maxPoint() const
Definition: rectangleMesh.hpp:106