28#include "bitpit_operators.hpp"
30#include "PabloUniform.hpp"
49#if BITPIT_ENABLE_MPI==1
65#if BITPIT_ENABLE_MPI==1
85#if BITPIT_ENABLE_MPI==1
114 PabloUniform::__reset(){
126 const int DUMP_VERSION = 1;
156 std::array<double, 3> origin = {{0., 0., 0.}};
247 darray3 coords = {{0., 0., 0.}};
249 for (
int i=0; i<3; i++){
250 coords[i] = m_origin[i] + m_L * coords_[i];
263 X = m_origin[0] + m_L * X_;
275 Y = m_origin[1] + m_L * Y_;
287 Z = m_origin[2] + m_L * Z_;
325 for (
int i=0; i<3; i++){
326 center[i] = m_origin[i] + m_L * center_[i];
336 darray3 center = {{0., 0., 0.}};
338 for (
int i=0; i<3; i++){
339 center[i] = m_origin[i] + m_L * center_[i];
352 for (
int i=0; i<3; i++){
353 center[i] = m_origin[i] + m_L * center_[i];
364 darray3 center = {{0., 0., 0.}};
366 for (
int i=0; i<3; i++){
367 center[i] = m_origin[i] + m_L * center_[i];
379 darray3 node = {{0., 0., 0.}};
381 for (
int i=0; i<3; i++){
382 node[i] = m_origin[i] + m_L * node_[i];
395 for (
int i=0; i<3; i++){
396 node[i] = m_origin[i] + m_L * node_[i];
409 for (
int i=0; i<3; i++){
410 nodes[j][i] = m_origin[i] + m_L * nodes_[j][i];
424 for (
int i=0; i<3; i++){
425 nodes[j][i] = m_origin[i] + m_L * nodes_[j][i];
460 darray3 coords = {{0., 0., 0.}};
462 for (
int i=0; i<3; i++){
463 coords[i] = m_origin[i] + m_L * coords_[i];
476 X = m_origin[0] + m_L * X_;
488 Y = m_origin[1] + m_L * Y_;
500 Z = m_origin[2] + m_L * Z_;
538 for (
int i=0; i<3; i++){
539 center[i] = m_origin[i] + m_L * center_[i];
549 darray3 center = {{0., 0., 0.}};
551 for (
int i=0; i<3; i++){
552 center[i] = m_origin[i] + m_L * center_[i];
565 for (
int i=0; i<3; i++){
566 center[i] = m_origin[i] + m_L * center_[i];
577 darray3 center = {{0., 0., 0.}};
579 for (
int i=0; i<3; i++){
580 center[i] = m_origin[i] + m_L * center_[i];
592 darray3 node = {{0., 0., 0.}};
594 for (
int i=0; i<3; i++){
595 node[i] = m_origin[i] + m_L * node_[i];
608 for (
int i=0; i<3; i++){
609 node[i] = m_origin[i] + m_L * node_[i];
622 for (
int i=0; i<3; i++){
623 nodes[j][i] = m_origin[i] + m_L * nodes_[j][i];
634 darray3vector nodes = {{{{0., 0., 0.}}, {{0., 0., 0.}}, {{0., 0., 0.}}}};
638 for (
int i=0; i<3; i++){
639 nodes[j][i] = m_origin[i] + m_L * nodes_[j][i];
713 darray3 cnode0, cnode1;
719 P1 =
getNode(nocts-1, nnodes-1);
721 for (
id=0;
id<nocts;
id++){
723 cnode1 =
getNode(
id, nnodes-1);
725 P0[i] =
min(P0[i], cnode0[i]);
726 P1[i] =
max(P1[i], cnode1[i]);
760 for (
int i=0; i<3; i++){
761 center[i] = m_origin[i] + m_L * center[i];
775 for (
int i=0; i<3; i++){
776 nodes[j][i] = m_origin[i] + m_L * nodes_[j][i];
800 for (
int i=0; i<3; i++){
801 point[i] = (point[i] - m_origin[i])/m_L;
812 for (
int i=0; i<3; i++){
813 point[i] = (point[i] - m_origin[i])/m_L;
826 for (
int i=0; i<3; i++){
827 point[i] = (point[i] - m_origin[i])/m_L;
839 for (
int i=0; i<3; i++){
840 point[i] = (point[i] - m_origin[i])/m_L;
850 for (
int i=0; i<3; i++){
851 point[i] = (point[i] - m_origin[i])/m_L;
866 for (
int i=0; i<3; i++){
867 node[i] = m_origin[i] + m_L * node[i];
888 name <<
"s" << std::setfill(
'0') << std::setw(4) <<
getNproc() <<
"-p" << std::setfill(
'0') << std::setw(4) <<
getRank() <<
"-" << filename <<
".vtu";
890 ofstream out(name.str().c_str());
893 ss << filename <<
"*.vtu cannot be opened and it won't be written." << endl;
900 int nofAll = nofGhosts + nofOctants;
901 out <<
"<?xml version=\"1.0\"?>" << endl
902 <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"BigEndian\">" << endl
903 <<
" <UnstructuredGrid>" << endl
905 out <<
" <Points>" << endl
906 <<
" <DataArray type=\"Float64\" Name=\"Coordinates\" NumberOfComponents=\""<< 3 <<
"\" format=\"ascii\">" << endl
907 <<
" " << std::fixed;
908 for(
int i = 0; i < nofNodes; i++)
911 for(
int j = 0; j < 3; ++j){
912 out << std::setprecision(6) << nodeCoordinates[j] <<
" ";
914 if((i+1)%4==0 && i!=nofNodes-1)
917 out << endl <<
" </DataArray>" << endl
918 <<
" </Points>" << endl
919 <<
" <Cells>" << endl
920 <<
" <DataArray type=\"UInt64\" Name=\"connectivity\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
922 for(
int i = 0; i < nofOctants; i++)
940 if((i+1)%3==0 && i!=nofOctants-1)
943 for(
int i = 0; i < nofGhosts; i++)
961 if((i+1)%3==0 && i!=nofGhosts-1)
964 out << endl <<
" </DataArray>" << endl
965 <<
" <DataArray type=\"UInt64\" Name=\"offsets\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
967 for(
int i = 0; i < nofAll; i++)
970 if((i+1)%12==0 && i!=nofAll-1)
973 out << endl <<
" </DataArray>" << endl
974 <<
" <DataArray type=\"UInt8\" Name=\"types\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
976 for(
int i = 0; i < nofAll; i++)
981 if((i+1)%12==0 && i!=nofAll-1)
984 out << endl <<
" </DataArray>" << endl
985 <<
" </Cells>" << endl
986 <<
" </Piece>" << endl
987 <<
" </UnstructuredGrid>" << endl
988 <<
"</VTKFile>" << endl;
993 name <<
"s" << std::setfill(
'0') << std::setw(4) <<
getNproc() <<
"-" << filename <<
".pvtu";
994 ofstream pout(name.str().c_str());
997 ss << filename <<
"*.pvtu cannot be opened and it won't be written." << endl;
1002 pout <<
"<?xml version=\"1.0\"?>" << endl
1003 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"BigEndian\">" << endl
1004 <<
" <PUnstructuredGrid GhostLevel=\"0\">" << endl
1005 <<
" <PPointData>" << endl
1006 <<
" </PPointData>" << endl
1007 <<
" <PCellData Scalars=\"\">" << endl;
1008 pout <<
" </PCellData>" << endl
1009 <<
" <PPoints>" << endl
1010 <<
" <PDataArray type=\"Float64\" Name=\"Coordinates\" NumberOfComponents=\"3\"/>" << endl
1011 <<
" </PPoints>" << endl;
1012 for(
int i = 0; i <
getNproc(); i++)
1013 pout <<
" <Piece Source=\"s" << std::setw(4) << std::setfill(
'0') <<
getNproc() <<
"-p" << std::setw(4) << std::setfill(
'0') << i <<
"-" << filename <<
".vtu\"/>" << endl;
1014 pout <<
" </PUnstructuredGrid>" << endl
1020#if BITPIT_ENABLE_MPI==1
1042 name <<
"s" << std::setfill(
'0') << std::setw(4) <<
getNproc() <<
"-p" << std::setfill(
'0') << std::setw(4) <<
getRank() <<
"-" << filename <<
".vtu";
1044 ofstream out(name.str().c_str());
1047 ss << filename <<
"*.vtu cannot be opened and it won't be written.";
1053 int nofAll = nofOctants;
1054 out <<
"<?xml version=\"1.0\"?>" << endl
1055 <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"BigEndian\">" << endl
1056 <<
" <UnstructuredGrid>" << endl
1058 out <<
" <CellData Scalars=\"Data\">" << endl;
1059 out <<
" <DataArray type=\"Float64\" Name=\"Data\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
1060 <<
" " << std::fixed;
1062 for(
int i = 0; i < ndata; i++)
1064 out << std::setprecision(6) << data[i] <<
" ";
1065 if((i+1)%4==0 && i!=ndata-1)
1068 out << endl <<
" </DataArray>" << endl
1069 <<
" </CellData>" << endl
1070 <<
" <Points>" << endl
1071 <<
" <DataArray type=\"Float64\" Name=\"Coordinates\" NumberOfComponents=\""<< 3 <<
"\" format=\"ascii\">" << endl
1072 <<
" " << std::fixed;
1073 for(
int i = 0; i < nofNodes; i++)
1076 for(
int j = 0; j < 3; ++j){
1077 out << std::setprecision(6) << nodeCoordinates[j] <<
" ";
1079 if((i+1)%4==0 && i!=nofNodes-1)
1082 out << endl <<
" </DataArray>" << endl
1083 <<
" </Points>" << endl
1084 <<
" <Cells>" << endl
1085 <<
" <DataArray type=\"UInt64\" Name=\"connectivity\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
1087 for(
int i = 0; i < nofOctants; i++)
1105 if((i+1)%3==0 && i!=nofOctants-1)
1108 out << endl <<
" </DataArray>" << endl
1109 <<
" <DataArray type=\"UInt64\" Name=\"offsets\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
1111 for(
int i = 0; i < nofAll; i++)
1114 if((i+1)%12==0 && i!=nofAll-1)
1117 out << endl <<
" </DataArray>" << endl
1118 <<
" <DataArray type=\"UInt8\" Name=\"types\" NumberOfComponents=\"1\" format=\"ascii\">" << endl
1120 for(
int i = 0; i < nofAll; i++)
1125 if((i+1)%12==0 && i!=nofAll-1)
1128 out << endl <<
" </DataArray>" << endl
1129 <<
" </Cells>" << endl
1130 <<
" </Piece>" << endl
1131 <<
" </UnstructuredGrid>" << endl
1132 <<
"</VTKFile>" << endl;
1137 name <<
"s" << std::setfill(
'0') << std::setw(4) <<
getNproc() <<
"-" << filename <<
".pvtu";
1138 ofstream pout(name.str().c_str());
1139 if(!pout.is_open()){
1141 ss << filename <<
"*.pvtu cannot be opened and it won't be written." << endl;
1146 pout <<
"<?xml version=\"1.0\"?>" << endl
1147 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"BigEndian\">" << endl
1148 <<
" <PUnstructuredGrid GhostLevel=\"0\">" << endl
1149 <<
" <PPointData>" << endl
1150 <<
" </PPointData>" << endl
1151 <<
" <PCellData Scalars=\"Data\">" << endl
1152 <<
" <PDataArray type=\"Float64\" Name=\"Data\" NumberOfComponents=\"1\"/>" << endl
1153 <<
" </PCellData>" << endl
1154 <<
" <PPoints>" << endl
1155 <<
" <PDataArray type=\"Float64\" Name=\"Coordinates\" NumberOfComponents=\"3\"/>" << endl
1156 <<
" </PPoints>" << endl;
1157 for(
int i = 0; i <
getNproc(); i++)
1158 pout <<
" <Piece Source=\"s" << std::setw(4) << std::setfill(
'0') <<
getNproc() <<
"-p" << std::setw(4) << std::setfill(
'0') << i <<
"-" << filename <<
".vtu\"/>" << endl;
1159 pout <<
" </PUnstructuredGrid>" << endl
1165#if BITPIT_ENABLE_MPI==1
Intersection class definition.
Para Tree is the user interface class.
uint8_t getNnodesperface() const
Octant * getPointOwner(const dvector &point)
double levelToSize(uint8_t level) const
uint32_t getNumOctants() const
const u32arr3vector & getNodes() const
virtual void restore(std::istream &stream)
double getLocalMinSize() const
void computeConnectivity()
ParaTree(const std::string &logfile=DEFAULT_LOG_FILE, MPI_Comm comm=MPI_COMM_WORLD)
darray3 getFaceCenter(uint32_t idx, uint8_t face) const
uint8_t getNnodes() const
int getPointOwnerRank(const darray3 &point)
double getSize(uint32_t idx) const
double getY(uint32_t idx) const
uint32_t getPointOwnerIdx(const double *point) const
darray3 getNode(uint32_t idx, uint8_t node) const
double getZ(uint32_t idx) const
double getArea(uint32_t idx) const
darray3 getCoordinates(uint32_t idx) const
uint32_t getNumGhosts() const
const u32vector2D & getGhostConnectivity() const
uint32_t getNumNodes() const
double getVolume(uint32_t idx) const
virtual int getDumpVersion() const
double getX(uint32_t idx) const
void getCenter(uint32_t idx, darray3 ¢erCoords) const
darray3 getNodeCoordinates(uint32_t node) const
const u32vector2D & getConnectivity() const
virtual void dump(std::ostream &stream, bool full=true)
void getNormal(uint32_t idx, uint8_t face, darray3 &normal) const
double getLocalMaxSize() const
std::array< T, d > max(const std::array< T, d > &x, const std::array< T, d > &y)
T uipow(const T &, unsigned int)
std::array< T, d > min(const std::array< T, d > &x, const std::array< T, d > &y)
void write(std::ostream &stream, const std::vector< bool > &container)
void read(std::istream &stream, std::vector< bool > &container)