25#include "bitpit_PABLO.hpp"
27#if BITPIT_ENABLE_MPI==1
28#include "PABLO_userDataComm.hpp"
29#include "PABLO_userDataLB.hpp"
33using namespace bitpit;
189#if BITPIT_ENABLE_MPI==1
193#include "bitpit_PABLO.hpp"
207 pablo7.setBalance(idx,
false);
210 for (iter=1; iter<6; iter++){
211 pablo7.adaptGlobalRefine();
217 double radius = 0.25;
220 uint32_t nocts = pablo7.getNumOctants();
221 uint32_t nghosts = pablo7.getNumGhosts();
222 vector<double> oct_data(nocts, 0.0), ghost_data(nghosts, 0.0);
225 for (
unsigned int i=0; i<nocts; i++){
227 vector<array<double,3> > nodes = pablo7.getNodes(i);
229 array<double,3> center = pablo7.getCenter(i);
230 for (
int j=0; j<4; j++){
231 double x = nodes[j][0];
232 double y = nodes[j][1];
233 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
234 oct_data[i] = (
pow((center[0]-xc),2.0)+
pow((center[1]-yc),2.0));
241 pablo7.updateConnectivity();
242 pablo7.writeTest(
"pablo00007_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data);
247 vector<double> weight(nocts, 1.0),weightGhost;
248 for (iter=start; iter<start+2; iter++){
249 for (
unsigned int i=0; i<nocts; i++){
251 vector<array<double,3> > nodes = pablo7.getNodes(i);
253 array<double,3> center = pablo7.getCenter(i);
254 for (
int j=0; j<4; j++){
256 double x = nodes[j][0];
257 double y = nodes[j][1];
258 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
262 pablo7.setMarker(i,1);
268 pablo7.setMarker(i,-1);
276 vector<double> oct_data_new;
277 vector<double> weight_new;
278 vector<uint32_t> mapper;
279 vector<bool> isghost;
281 nocts = pablo7.getNumOctants();
282 oct_data_new.resize(nocts, 0.0);
283 weight_new.resize(nocts,0.0);
288 for (uint32_t i=0; i<nocts; i++){
289 pablo7.getMapping(i, mapper, isghost);
290 if (pablo7.getIsNewC(i)){
291 for (
int j=0; j<4; j++){
292 oct_data_new[i] += oct_data[mapper[j]]/4;
293 weight_new[i] += weight[mapper[j]];
296 else if (pablo7.getIsNewR(i)){
297 oct_data_new[i] += oct_data[mapper[0]];
298 weight_new[i] += weight[mapper[0]];
301 oct_data_new[i] += oct_data[mapper[0]];
302 weight_new[i] += weight[mapper[0]];
307 pablo7.updateConnectivity();
308 pablo7.writeTest(
"pablo00007_iter"+to_string(
static_cast<unsigned long long>(iter)), oct_data_new);
310 oct_data = oct_data_new;
314#if BITPIT_ENABLE_MPI==1
316 UserDataLB<vector<double> > data_lb(weight,weightGhost);
317 pablo7.loadBalance(data_lb, &weight);
321 for (
unsigned int i=0; i<weight.size(); i++){
326 pablo7.updateConnectivity();
327 pablo7.writeTest(
"pablo00007_iter"+to_string(
static_cast<unsigned long long>(iter)), weight);
333int main(
int argc,
char *argv[])
335#if BITPIT_ENABLE_MPI==1
336 MPI_Init(&argc,&argv);
344#if BITPIT_ENABLE_MPI==1
345 MPI_Comm_size(MPI_COMM_WORLD, &nProcs);
346 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
360 }
catch (
const std::exception &exception) {
365#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()