Commit 234f2bac authored by Pietro Incardona's avatar Pietro Incardona

Adding cell-list getParam

parent 9175f64c
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
SUBDIRS := $(wildcard */.)
all: $(SUBDIRS)
clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean; \
done
all clean run: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
......@@ -14,7 +14,10 @@ pse_1d: $(OBJ)
all: pse_1d
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; ./pse_1d
.PHONY: clean all run
clean:
rm -f *.o *~ core pse_1d
......
......@@ -14,7 +14,10 @@ pse_1d_128: $(OBJ_128)
all: pse_1d_128
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; ./pse_1d_128
.PHONY: clean all run
clean:
rm -f *.o *~ core pse_1d_128
......
......@@ -14,6 +14,9 @@ diff_1d: $(OBJ)
all: diff_1d
run: all
source $$HOME/openfpm_vars; mpirun -np 4 ./diff_1d
.PHONY: clean all
clean:
......
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
......@@ -18,7 +18,9 @@ stokes_2d_eigen: $(OBJ_EIGEN)
stokes_2d_petsc: $(OBJ_PETSC)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
run: all
source $$HOME/openfpm_vars; mpirun -np 3 ./stokes_2d_eigen; mpirun -np 3 ./stokes_2d_petsc
.PHONY: clean all
clean:
......
......@@ -18,8 +18,10 @@ stokes_3d_eigen: $(OBJ_EIGEN)
stokes_3d_petsc: $(OBJ_PETSC)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 3 ./stokes_3d_eigen; mpirun -np 3 ./stokes_3d_petsc
.PHONY: clean all run
clean:
rm -f *.o *~ core stokes_3d_eigen stokes_3d_petsc
......
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
......@@ -14,7 +14,10 @@ plot: $(OBJ)
all: plot
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; ./plot
.PHONY: clean all run
clean:
rm -f *.o *~ core plot
......
......@@ -9,13 +9,16 @@ OBJ = main.o
%.o: %.cpp
$(CC) -O3 -g3 -c --std=c++11 -fext-numeric-literals -o $@ $< $(INCLUDE_PATH)
plot: $(OBJ)
conv_p: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) -lquadmath
all: plot
all: conv_p
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; ./conv_p
.PHONY: clean all run
clean:
rm -f *.o *~ core plot
rm -f *.o *~ core conv_p
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
......@@ -14,7 +14,10 @@ vect: $(OBJ)
all: vect
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 2 ./vect
.PHONY: clean all run
clean:
rm -f *.o *~ core vect
......
......@@ -14,7 +14,10 @@ cell: $(OBJ)
all: cell
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 2 ./cell
.PHONY: clean all run
clean:
rm -f *.o *~ core cell
......
......@@ -14,7 +14,10 @@ expr: $(OBJ)
all: expr
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 3 ./expr
.PHONY: clean all run
clean:
rm -f *.o *~ core expr
......
......@@ -18,7 +18,10 @@ md_dyn: $(OBJ)
md_dyn_expr: $(OBJ_EXPR)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 3 ./md_dyn; mpirun -np 3 ./md_dyn_expr
.PHONY: clean all run
clean:
rm -f *.o *~ core md_dyn md_dyn_expr
......
......@@ -14,7 +14,10 @@ vect: $(OBJ)
all: vect
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 2 ./vect
.PHONY: clean all run
clean:
rm -f *.o *~ core vect
......
......@@ -7,14 +7,17 @@ LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
$(CC) -O0 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
cell: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: cell
.PHONY: clean all
run: all
source $$HOME/openfpm_vars; mpirun -np 2 ./cell
.PHONY: clean all run
clean:
rm -f *.o *~ core cell
......
......@@ -46,8 +46,10 @@ int main(int argc, char* argv[])
// Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
float r_cut = 0.05;
// ghost, big enough to contain the interaction radius
Ghost<3,float> ghost(1.0/(128-2));
Ghost<3,float> ghost(r_cut);
openfpm::vector< vector_dist<3,float, aggregate<double,double>> > phases;
......@@ -55,9 +57,9 @@ int main(int argc, char* argv[])
phases.add( vector_dist<3,float, aggregate<double,double>>(4096,box,bc,ghost) );
// The other 3 phases
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(1).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(2).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(3).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(0).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(0).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(0).getDecomposition(),4096) );
//! \cond [Initialization and parameters] \endcond
......@@ -123,7 +125,15 @@ int main(int argc, char* argv[])
// Construct one single Multi-phase cell list to use in the computation
// in 3d, precision float, 2 bit dedicated to the phase for a maximum of 2^2 = 4 (Maximum number of phase)
//
//
size_t div[3];
Box<3,float> box_cl;
phases.get(0).getCellListParams(r_cut,div,box_cl);
CellListM<3,float,2> NN;
NN.Initialize(box_cl,div);
// for all the phases i
for (size_t i = 0; i < phases.size() ; i++)
......@@ -157,7 +167,7 @@ int main(int argc, char* argv[])
//! \cond [cl usage] \endcond
vector_dist<3,float, aggregate<double,double> > & current_phase = phases.get(0);
/* vector_dist<3,float, aggregate<double,double> > & current_phase = phases.get(0);
// Get the iterator of the particles of phase 0
auto it2 = current_phase.getIterator();
......@@ -193,7 +203,7 @@ int main(int argc, char* argv[])
// Next particle p
++it2;
}
}*/
//! \cond [cl usage] \endcond
......
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
all clean run: $(SUBDIRS)
clean: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
This diff is collapsed.
......@@ -176,8 +176,6 @@ void Test2D_sub(const Box<2,float> & domain, long int k)
{
BOOST_TEST_CHECKPOINT( "Testing 2D grid k=" << k );
//! [Create and access a distributed grid]
// grid size
size_t sz[2];
sz[0] = k;
......@@ -1192,16 +1190,12 @@ void Test3D_dup(const Box<3,float> & domain, long int k)
// Ghost
Ghost<3,float> g(0.01 / factor);
//! [Construct two grid with the same decomposition]
// Distributed grid with id decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> * g_dist1 = new grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>>(sz,domain,g);
// another grid with the same decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> * g_dist2 = new grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>>(g_dist1->getDecomposition(),sz,domain,g);
//! [Construct two grid with the same decomposition]
delete g_dist1;
bool ret = g_dist2->getDecomposition().check_consistency();
......
......@@ -857,6 +857,73 @@ public:
//! dimensions of space
static const unsigned int dims = dim;
/*! \brief Operator= for distributed vector
*
* \param v vector to copy
*
*/
vector_dist<dim,St,prop,Decomposition,Memory> & operator=(const vector_dist<dim,St,prop,Decomposition,Memory> & v)
{
dec = v.dec;
g_m = v.g_m;
v_pos = v.v_pos;
v_prp = v.v_prp;
return *this;
}
/*! \brief Operator= for distributed vector
*
* \param v vector to copy
*
*/
vector_dist<dim,St,prop,Decomposition,Memory> & operator=(vector_dist<dim,St,prop,Decomposition,Memory> && v)
{
dec.swap(v.dec);
g_m = v.g_m;
v_pos.swap(v.v_pos);
v_prp.swap(v.v_prp);
return *this;
}
/*! \brief Constructor
*
* \param np number of elements
* \param box domain where the vector of elements live
* \param boundary conditions
* \param g Ghost margins
*
*/
vector_dist(const vector_dist<dim,St,prop,Decomposition,Memory> & v)
:dec(v.v_cl),v_cl(v.v_cl)
{
#ifdef SE_CLASS2
check_new(this,8,VECTOR_DIST_EVENT,4);
#endif
this->operator=(v);
}
/*! \brief Constructor
*
* \param np number of elements
* \param box domain where the vector of elements live
* \param boundary conditions
* \param g Ghost margins
*
*/
vector_dist(vector_dist<dim,St,prop,Decomposition,Memory> && v)
:v_cl(v.v_cl)
{
#ifdef SE_CLASS2
check_new(this,8,VECTOR_DIST_EVENT,4);
#endif
this->operator=(v);
}
/*! \brief Constructor
*
......@@ -1859,6 +1926,20 @@ public:
}
}
/*! \brief Get the Celllist parameters
*
* \param r_cut spacing of the cell-list
* \param division required for the cell-list
* \param box where the Cell list must be defined (In general Processor domain + Ghost)
* \param Optionally a request to make the space a littler bit larger than Processor domain + Ghost
* keeping the cell list consistent with the requests
*
*/
void getCellListParams(St r_cut, size_t (&div)[dim],Box<dim, St> & box, Ghost<dim,St> enlarge = Ghost<dim,St>(0.0))
{
box = cl_param_calculate(div,r_cut,enlarge);
}
/* \brief It return the id of structure in the allocation list
*
* \see print_alloc and SE_CLASS2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment