25#if BITPIT_ENABLE_MPI==1
29#include "bitpit_PABLO.hpp"
31#if BITPIT_ENABLE_MPI==1
32#include "PABLO_userDataComm.hpp"
36using namespace bitpit;
125 vector<double> doubleData;
126 vector<float> floatData;
127 Data(uint32_t nocts): doubleData(nocts,0.0), floatData(nocts,0.0){};
129 this->doubleData = rhs.doubleData;
130 this->floatData = rhs.floatData;
146 for (iter=1; iter<5; iter++){
147 pablo6.adaptGlobalRefine();
150#if BITPIT_ENABLE_MPI==1
152 pablo6.loadBalance();
158 double radius = 0.25;
161 uint32_t nocts = pablo6.getNumOctants();
162 uint32_t nghosts = pablo6.getNumGhosts();
164 Data octdata(nocts), ghostdata(nghosts);
168 for (
unsigned int i=0; i<nocts; i++){
169 vector<array<double,3> > nodes = pablo6.getNodes(i);
170 for (
int j=0; j<4; j++){
171 double x = nodes[j][0];
172 double y = nodes[j][1];
173 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
175 octdata.doubleData[i] = 1.0;
176 octdata.floatData[i] = 1.0;
182 for (
unsigned int i=0; i<nghosts; i++){
184 Octant *oct = pablo6.getGhostOctant(i);
185 vector<array<double,3> > nodes = pablo6.getNodes(oct);
186 for (
int j=0; j<4; j++){
187 double x = nodes[j][0];
188 double y = nodes[j][1];
189 if ((
pow((x-xc),2.0)+
pow((y-yc),2.0) <=
pow(radius,2.0))){
191 ghostdata.doubleData[i] = 1.0;
192 ghostdata.floatData[i] = 1.0;
199 pablo6.updateConnectivity();
200 pablo6.writeTest(
"pablo00006_double_iter"+to_string(
static_cast<unsigned long long>(iter)), octdata.doubleData);
203 int start = iter + 1;
204 for (iter=start; iter<start+25; iter++){
206 Data octdatasmooth(nocts);
207 vector<uint32_t> neigh, neigh_t;
208 vector<bool> isghost, isghost_t;
209 uint8_t iface, nfaces, codim;
210 for (
unsigned int i=0; i<nocts; i++){
215 for (codim=1; codim<dim+1; codim++){
219 else if (codim == 2){
222 for (iface=0; iface<nfaces; iface++){
223 pablo6.findNeighbours(i,iface,codim,neigh_t,isghost_t);
224 neigh.insert(neigh.end(), neigh_t.begin(), neigh_t.end());
225 isghost.insert(isghost.end(), isghost_t.begin(), isghost_t.end());
231 octdatasmooth.doubleData[i] = octdata.doubleData[i]/(neigh.size()+1);
232 octdatasmooth.floatData[i] = octdata.floatData[i]/(neigh.size()+1);
233 for (
unsigned int j=0; j<neigh.size(); j++){
236 octdatasmooth.doubleData[i] += ghostdata.doubleData[neigh[j]]/(neigh.size()+1);
237 octdatasmooth.floatData[i] += ghostdata.floatData[neigh[j]]/(neigh.size()+1);
241 octdatasmooth.doubleData[i] += octdata.doubleData[neigh[j]]/(neigh.size()+1);
242 octdatasmooth.floatData[i] += octdata.floatData[neigh[j]]/(neigh.size()+1);
248 pablo6.updateConnectivity();
249 pablo6.writeTest(
"pablo00006_iter"+to_string(
static_cast<unsigned long long>(iter)), octdatasmooth.doubleData);
251#if BITPIT_ENABLE_MPI==1
253 UserDataComm<Data> data_comm(octdatasmooth, ghostdata);
254 pablo6.communicate(data_comm);
257 octdata.doubleData = octdatasmooth.doubleData;
258 octdata.floatData = octdatasmooth.floatData;
265int main(
int argc,
char *argv[])
267#if BITPIT_ENABLE_MPI==1
268 MPI_Init(&argc,&argv);
276#if BITPIT_ENABLE_MPI==1
277 MPI_Comm_size(MPI_COMM_WORLD, &nProcs);
278 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
292 }
catch (
const std::exception &exception) {
297#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()