25#if BITPIT_ENABLE_MPI==1
29#include "bitpit_PABLO.hpp"
31#if BITPIT_ENABLE_MPI==1
32#include "PABLO_userDataComm.hpp"
33#include "PABLO_userDataLB.hpp"
37using namespace bitpit;
73 pablo8.setBalance(idx,
false);
76 for (iter=1; iter<6; iter++){
77 pablo8.adaptGlobalRefine();
86 uint32_t nocts = pablo8.getNumOctants();
87 uint32_t nghosts = pablo8.getNumGhosts();
88 vector<double> oct_data(nocts, 0.0), ghost_data(nghosts, 0.0);
91 for (
unsigned int i=0; i<nocts; i++){
93 vector<array<double,3> > nodes = pablo8.getNodes(i);
95 array<double,3> center = pablo8.getCenter(i);
96 for (
int j=0; j<4; j++){
97 double x = nodes[j][0];
98 double y = nodes[j][1];
99 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
100 oct_data[i] = (
pow((center[0]-xc),2.0)+
pow((center[1]-yc),2.0));
107 pablo8.updateConnectivity();
108 pablo8.writeTest(
"pablo00008_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data);
112 for (iter=start; iter<start+2; iter++){
113 for (
unsigned int i=0; i<nocts; i++){
115 vector<array<double,3> > nodes = pablo8.getNodes(i);
117 array<double,3> center = pablo8.getCenter(i);
118 for (
int j=0; j<4; j++){
119 double x = nodes[j][0];
120 double y = nodes[j][1];
121 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
125 pablo8.setMarker(i,1);
130 pablo8.setMarker(i,-1);
137 vector<double> oct_data_new;
138 vector<uint32_t> mapper;
139 vector<bool> isghost;
141 nocts = pablo8.getNumOctants();
142 oct_data_new.resize(nocts, 0.0);
147 for (uint32_t i=0; i<nocts; i++){
148 pablo8.getMapping(i, mapper, isghost);
149 if (pablo8.getIsNewC(i)){
150 for (
int j=0; j<4; j++){
152 oct_data_new[i] += ghost_data[mapper[j]]/4;
155 oct_data_new[i] += oct_data[mapper[j]]/4;
160 oct_data_new[i] += oct_data[mapper[0]];
165 pablo8.updateConnectivity();
166 pablo8.writeTest(
"pablo00008_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data_new);
168 oct_data = oct_data_new;
171#if BITPIT_ENABLE_MPI==1
175 UserDataLB<vector<double> > data_lb(oct_data,ghost_data);
176 pablo8.loadBalance(data_lb, levels);
180 pablo8.updateConnectivity();
181 pablo8.writeTest(
"pablo00008_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data);
187int main(
int argc,
char *argv[])
189#if BITPIT_ENABLE_MPI==1
190 MPI_Init(&argc,&argv);
198#if BITPIT_ENABLE_MPI==1
199 MPI_Comm_size(MPI_COMM_WORLD, &nProcs);
200 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
214 }
catch (
const std::exception &exception) {
219#if BITPIT_ENABLE_MPI==1
void initialize(log::Mode mode, bool reset, int nProcesses, int rank)
std::array< T, d > pow(std::array< T, d > &x, double p)
#define BITPIT_UNUSED(variable)
Logger & cout(log::Level defaultSeverity, log::Visibility defaultVisibility)
LoggerManipulator< log::Level > fileVerbosity(const log::Level &threshold)
Logger & disableConsole(Logger &logger, const log::Level &level)
LoggerManager & manager()