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;
67 pablo9.setBalance(idx,
false);
70 for (iter=1; iter<6; iter++){
71 pablo9.adaptGlobalRefine();
74#if BITPIT_ENABLE_MPI==1
85 uint32_t nocts = pablo9.getNumOctants();
86 uint32_t nghosts = pablo9.getNumGhosts();
87 vector<double> oct_data(nocts, 0.0), ghost_data(nghosts, 0.0);
90 for (
unsigned int i=0; i<nocts; i++){
92 vector<array<double,3> > nodes = pablo9.getNodes(i);
94 array<double,3> center = pablo9.getCenter(i);
95 for (
int j=0; j<8; j++){
96 double x = nodes[j][0];
97 double y = nodes[j][1];
98 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
99 oct_data[i] = (
pow((center[0]-xc),2.0)+
pow((center[1]-yc),2.0));
106 pablo9.updateConnectivity();
107 pablo9.writeTest(
"pablo00009_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data);
111 for (iter=start; iter<start+2; iter++){
112 for (
unsigned int i=0; i<nocts; i++){
114 vector<array<double,3> > nodes = pablo9.getNodes(i);
116 array<double,3> center = pablo9.getCenter(i);
117 for (
int j=0; j<8; j++){
118 double x = nodes[j][0];
119 double y = nodes[j][1];
120 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
124 pablo9.setMarker(i,1);
129 pablo9.setMarker(i,-1);
136 vector<double> oct_data_new;
137 vector<uint32_t> mapper;
138 vector<bool> isghost;
140 nocts = pablo9.getNumOctants();
141 oct_data_new.resize(nocts, 0.0);
146 for (uint32_t i=0; i<nocts; i++){
147 pablo9.getMapping(i, mapper, isghost);
148 if (pablo9.getIsNewC(i)){
149 for (
int j=0; j<8; j++){
151 oct_data_new[i] += ghost_data[mapper[j]]/8;
154 oct_data_new[i] += oct_data[mapper[j]]/8;
158 else if (pablo9.getIsNewR(i)){
159 oct_data_new[i] += oct_data[mapper[0]];
162 oct_data_new[i] += oct_data[mapper[0]];
166 oct_data = oct_data_new;
167 vector<double>().swap(oct_data_new);
170 pablo9.updateConnectivity();
171 pablo9.writeTest(
"pablo00009_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data);
175#if BITPIT_ENABLE_MPI==1
179 UserDataLB<vector<double> > data_lb(oct_data,ghost_data);
180 pablo9.loadBalance(data_lb, levels);
184 pablo9.updateConnectivity();
185 pablo9.writeTest(
"pablo00009_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data);
191int main(
int argc,
char *argv[])
193#if BITPIT_ENABLE_MPI==1
194 MPI_Init(&argc,&argv);
202#if BITPIT_ENABLE_MPI==1
203 MPI_Comm_size(MPI_COMM_WORLD, &nProcs);
204 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
218 }
catch (
const std::exception &exception) {
223#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()