Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

Commit 48b4c296 authored by Berenger Bramas's avatar Berenger Bramas

Merge remote-tracking branch 'origin/simgrid'

parents 64603413 7863df56
...@@ -114,9 +114,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ ...@@ -114,9 +114,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
option( SCALFMM_DISABLE_NATIVE_OMP4 "Set to ON to disable the gcc/intel omp4" ON ) option( SCALFMM_DISABLE_NATIVE_OMP4 "Set to ON to disable the gcc/intel omp4" ON )
endif() endif()
option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF ) option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF )
# SIMGRID and peformance models options
option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF ) option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF )
option( SCALFMM_SIMGRID_TASKNAMEPARAMS "Set to ON to have verbose information in the task name" OFF ) option( STARPU_SIMGRID_MLR_MODELS "Set to ON to enable MLR models need for calibration and simulation" OFF )
# STARPU options # STARPU options
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF) CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF) CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF) CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF)
...@@ -599,6 +600,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ ...@@ -599,6 +600,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES}; ${STARPU_INCLUDE_DIRS}") set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES}; ${STARPU_INCLUDE_DIRS}")
endif() endif()
# Adding SimGrid includes
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES};$ENV{SIMGRID_INCLUDE}")
message(STATUS " Adding SIMGRID = $ENV{SIMGRID_INCLUDE}")
# TODO: replace this by a component of find starpu # TODO: replace this by a component of find starpu
OPTION( SCALFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF ) OPTION( SCALFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF )
MESSAGE( STATUS "SCALFMM_USE_OPENCL = ${SCALFMM_USE_OPENCL}" ) MESSAGE( STATUS "SCALFMM_USE_OPENCL = ${SCALFMM_USE_OPENCL}" )
......
#ifndef __STARPU_CODELET_PARAMETERS_H__
#define __STARPU_CODELET_PARAMETERS_H__
#include <starpu.h>
#include "../StarPUUtils/FStarPUUtils.hpp"
#ifdef __cplusplus
extern "C"
{
#endif
/* P2P */
static const char *p2p_cl_in_parameters_names[] = { "NbLeavesBlock", "SizeInterval", "NbParticlesGroup", "NbInteractions" };
static unsigned p2p_cl_in_combi1 [4] = { 0, 0, 1, 0 };
static unsigned p2p_cl_in_combi2 [4] = { 0, 0, 0, 1 };
static unsigned *p2p_cl_in_combinations[] = { p2p_cl_in_combi1, p2p_cl_in_combi2 };
static inline void p2p_cl_in_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3]);
}
/* P2P_out */
static const char *p2p_cl_inout_parameters_names[] = { "NbLeavesBlock", "SizeInterval", "NbParticlesGroup", "iNbLeavesBlock", "iSizeInterval", "iNBParticlesGroup", "OutsideInteractionsSize", "NbDiff0", "NbDiff1", "NbInteractions" };
static unsigned p2p_cl_inout_combi1 [10] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 };
static unsigned p2p_cl_inout_combi2 [10] = { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 };
static unsigned p2p_cl_inout_combi3 [10] = { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 };
static unsigned p2p_cl_inout_combi4 [10] = { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 };
static unsigned p2p_cl_inout_combi5 [10] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 };
static unsigned p2p_cl_inout_combi6 [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 };
static unsigned p2p_cl_inout_combi7 [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
static unsigned *p2p_cl_inout_combinations[] = { p2p_cl_inout_combi1, p2p_cl_inout_combi2, p2p_cl_inout_combi3, p2p_cl_inout_combi4, p2p_cl_inout_combi5, p2p_cl_inout_combi6, p2p_cl_inout_combi7 };
static inline void p2p_cl_inout_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
std::vector<OutOfBlockInteraction>* outsideInteractions;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&outsideInteractions,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6],
&parameters[7],
&parameters[8],
&parameters[9]);
}
/* P2M */
static const char *p2m_cl_parameters_names[] = { "NbCellsBlock", "SizeInterval", "NbParticlesGroup" };
static unsigned p2m_cl_combi1 [3] = { 0, 0, 1 };
static unsigned *p2m_cl_combinations[] = { p2m_cl_combi1 };
static inline void p2m_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&i,
&parameters[0],
&parameters[1],
&parameters[2]);
}
/* M2M */
static const char *m2m_cl_parameters_names[] = { "Lvl", "NbCellsBlock", "SizeInterval", "NbCellsBlockLvl+1", "SizeIntervalLvl+1", "NbDiff", "NbChildParent" };
static unsigned m2m_cl_combi1 [7] = { 0, 0, 0, 0, 0, 1, 0 };
static unsigned m2m_cl_combi2 [7] = { 0, 0, 0, 0, 1, 1, 0 };
static unsigned *m2m_cl_combinations[] = { m2m_cl_combi1, m2m_cl_combi2 };
static inline void m2m_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6]);
}
/* M2L */
static const char *m2l_cl_in_parameters_names[] = { "Lvl", "NbLeavesBlock", "SizeInterval", "NbM2LInteractions" };
static unsigned m2l_cl_in_combi1 [4] = { 0, 0, 0, 1 };
static unsigned *m2l_cl_in_combinations[] = { m2l_cl_in_combi1 };
static inline void m2l_cl_in_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3]);
}
/* M2L_out */
static const char *m2l_cl_inout_parameters_names[] = { "Lvl", "NbLeavesBlock", "SizeInterval", "iNbLeavesBlock", "iSizeInterval", "OutsideInteractionsSize", "NbDiff0", "NbDiff1" };
static unsigned m2l_cl_inout_combi1 [8] = { 0, 0, 0, 0, 0, 1, 0, 0 };
static unsigned m2l_cl_inout_combi2 [8] = { 0, 0, 0, 0, 0, 0, 1, 0 };
static unsigned *m2l_cl_inout_combinations[] = { m2l_cl_inout_combi1, m2l_cl_inout_combi2 };
static inline void m2l_cl_inout_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
const std::vector<OutOfBlockInteraction>* outsideInteractions;
int idxLevel, i, m;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&outsideInteractions,
&i,
&m,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6],
&parameters[7]);
}
/* L2L */
static const char *l2l_cl_parameters_names[] = { "Lvl", "NbCellsBlock", "SizeInterval", "NbCellsBlockLvl+1", "SizeIntervalLvl+1", "NbDiff", "NbChildParent" };
static unsigned l2l_cl_combi1 [7] = { 0, 0, 0, 0, 0, 1, 0 };
static unsigned *l2l_cl_combinations[] = { l2l_cl_combi1 };
static inline void l2l_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6]);
}
/* L2L_NOCOMMUTE */
static const char *l2l_cl_nocommute_parameters_names[] = { "Lvl", "NbCellsBlock", "SizeInterval", "NbCellsBlockLvl+1", "SizeIntervalLvl+1", "NbDiff", "NbChildParent" };
static unsigned l2l_cl_nocommute_combi1 [7] = { 0, 0, 0, 0, 0, 1, 0 };
static unsigned *l2l_cl_nocommute_combinations[] = { l2l_cl_nocommute_combi1 };
static inline void l2l_cl_nocommute_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6]);
}
/* L2P */
static const char *l2p_cl_parameters_names[] = { "NbCellsBlock", "SizeInterval", "NbParticlesGroup" };
static unsigned l2p_cl_combi1 [3] = { 0, 0, 1 };
static unsigned *l2p_cl_combinations[] = { l2p_cl_combi1 };
static inline void l2p_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3]);
}
#ifdef __cplusplus
}
#endif
#endif /* __STARPU_CODELET_PARAMETERS_H__ */
...@@ -102,7 +102,11 @@ public: ...@@ -102,7 +102,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->bottomPassPerform(&leafCells, &containers); worker->get<ThisClass>(FSTARPU_CPU_IDX)->bottomPassPerform(&leafCells, &containers);
} }
...@@ -132,7 +136,11 @@ public: ...@@ -132,7 +136,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
int idxLevel = 0; int idxLevel = 0;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize);
#endif
CellContainerClass subCellGroup( CellContainerClass subCellGroup(
(unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[2]), (unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[2]),
...@@ -243,7 +251,11 @@ public: ...@@ -243,7 +251,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
int idxLevel = 0; int idxLevel = 0;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->transferInPassPerform(&currentCells, idxLevel); worker->get<ThisClass>(FSTARPU_CPU_IDX)->transferInPassPerform(&currentCells, idxLevel);
} }
...@@ -301,7 +313,11 @@ public: ...@@ -301,7 +313,11 @@ public:
const std::vector<OutOfBlockInteraction>* outsideInteractions; const std::vector<OutOfBlockInteraction>* outsideInteractions;
int intervalSize; int intervalSize;
int mode = 0; int mode = 0;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &outsideInteractions, &intervalSize, &mode, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &outsideInteractions, &intervalSize, &mode); starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &outsideInteractions, &intervalSize, &mode);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->transferInoutPassPerform(&currentCells, &externalCells, idxLevel, outsideInteractions, mode); worker->get<ThisClass>(FSTARPU_CPU_IDX)->transferInoutPassPerform(&currentCells, &externalCells, idxLevel, outsideInteractions, mode);
} }
...@@ -353,7 +369,11 @@ public: ...@@ -353,7 +369,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
int idxLevel = 0; int idxLevel = 0;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize);
#endif
CellContainerClass subCellGroup( CellContainerClass subCellGroup(
(unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[2]), (unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[2]),
...@@ -457,7 +477,11 @@ public: ...@@ -457,7 +477,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->directInPassPerform(&containers); worker->get<ThisClass>(FSTARPU_CPU_IDX)->directInPassPerform(&containers);
} }
...@@ -506,7 +530,11 @@ public: ...@@ -506,7 +530,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
const std::vector<OutOfBlockInteraction>* outsideInteractions = nullptr; const std::vector<OutOfBlockInteraction>* outsideInteractions = nullptr;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &outsideInteractions, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &outsideInteractions, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &outsideInteractions, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->directInoutPassPerform(&containers, &externalContainers, outsideInteractions); worker->get<ThisClass>(FSTARPU_CPU_IDX)->directInoutPassPerform(&containers, &externalContainers, outsideInteractions);
} }
...@@ -547,7 +575,11 @@ public: ...@@ -547,7 +575,11 @@ public:
FStarPUPtrInterface* worker = nullptr; FStarPUPtrInterface* worker = nullptr;
int intervalSize; int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize); starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->mergePassPerform(&leafCells, &containers); worker->get<ThisClass>(FSTARPU_CPU_IDX)->mergePassPerform(&leafCells, &containers);
} }
......
...@@ -706,7 +706,7 @@ static struct starpu_task *pop_task_heteroprio_policy(unsigned sched_ctx_id) ...@@ -706,7 +706,7 @@ static struct starpu_task *pop_task_heteroprio_policy(unsigned sched_ctx_id)
if(child_sched_ctx != STARPU_NMAX_SCHED_CTXS){ if(child_sched_ctx != STARPU_NMAX_SCHED_CTXS){
starpu_sched_ctx_revert_task_counters(sched_ctx_id, task->flops); starpu_sched_ctx_revert_task_counters(sched_ctx_id, task->flops);
#if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3) #if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3)
starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx, 1); starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx, 1, 1);
#else #else
starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx); starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx);
#endif #endif
......
#ifndef FSTARPUTASKNAMEPARAMS_HPP
#define FSTARPUTASKNAMEPARAMS_HPP
#include "../../Utils/FGlobal.hpp"
#include <list>
#include <cstring>
#include <cstdio>
/**
* This class creates task name for starpu
* it is used for simgrid (to pass task parameters)
*/
class FStarPUTaskNameParams{
protected:
std::list<const char*> names;
FILE* fout;
int taskid;
public:
FStarPUTaskNameParams() : fout(nullptr), taskid(0){
const char* fname = getenv("SCALFMM_SIMGRIDOUT")?getenv("SCALFMM_SIMGRIDOUT"):"/tmp/scalfmm.out";
fout = fopen(fname, "w");
std::cout << "output task name in " << fname << "\n";
}
~FStarPUTaskNameParams(){
fclose(fout);
clear();
}
void clear(){
while(names.size()){
delete[] names.front();
names.pop_front();
}
}
template <typename ... Params>
const char* print(const char key[], const char format[], Params... args ){
const size_t length = 512;
char* name = new char[length+1];
snprintf(name, length, "%s_%d", key, taskid++);
name[length] = '\0';
names.push_back(name);
fprintf(fout, "%s, %d, ", key, taskid);
fprintf(fout, format, args...);
return name;
}
const char* add(const char key[], const char* strToCpy){
const size_t length = 512;
char* name = new char[length+1];
snprintf(name, length, "%s_%d", key, taskid++);
name[length] = '\0';
names.push_back(name);
fprintf(fout, "%s=", name);
fprintf(fout, strToCpy);
return name;
}
};
#endif // FSTARPUTASKNAMEPARAMS_HPP
...@@ -167,6 +167,6 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@"); ...@@ -167,6 +167,6 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
#cmakedefine SCALFMM_SIMGRID_NODATA #cmakedefine SCALFMM_SIMGRID_NODATA
#cmakedefine SCALFMM_SIMGRID_TASKNAMEPARAMS #cmakedefine STARPU_SIMGRID_MLR_MODELS
#endif // CONFIG_H #endif // CONFIG_H
...@@ -45,10 +45,282 @@ ...@@ -45,10 +45,282 @@
#define RANDOM_PARTICLES #define RANDOM_PARTICLES
template <class FReal>
class FSphericalRandomLoader : public FAbstractLoader<FReal> {
protected:
const int nbParticles; //< the number of particles
const FReal boxWidth; //< the box width
const FPoint<FReal> centerOfBox; //< The center of box
const bool nu;
const bool snu;
const bool su;
const bool elu;
const bool ssnu;
const bool elsu;
FReal rotationMatrix[3][3];
void initRotationMatrix(){
const FReal alpha = FMath::FPi<FReal>()/8;
const FReal omega = FMath::FPi<FReal>()/4;
FReal yrotation[3][3];
yrotation[0][0] = FMath::Cos(alpha); yrotation[0][1] = 0.0; yrotation[0][2] = FMath::Sin(alpha);
yrotation[1][0] = 0.0; yrotation[1][1] = 1.0; yrotation[1][2] = 0.0;
yrotation[2][0] = -FMath::Sin(alpha); yrotation[2][1] = 0.0; yrotation[2][2] = FMath::Cos(alpha);
FReal zrotation[3][3];
zrotation[0][0] = FMath::Cos(omega); zrotation[0][1] = -FMath::Sin(omega); zrotation[0][2] = 0.0;
zrotation[1][0] = FMath::Sin(omega); zrotation[1][1] = FMath::Cos(omega); zrotation[1][2] = 0.0;
zrotation[2][0] = 0.0; zrotation[2][1] = 0.0; zrotation[2][2] = 1.0;
for(int i = 0 ; i < 3 ; ++i){
for(int j = 0 ; j < 3 ; ++j){
FReal sum = 0.0;
for(int k = 0 ; k < 3 ; ++k){
sum += zrotation[i][k] * yrotation[k][j];
}
rotationMatrix[i][j] = sum;
}
}
}
public:
/**
* The constructor need the simulation data
*/
FSphericalRandomLoader(const int inNbParticles, const bool inNu = false,
const bool inSnu = false,
const bool inSu = false,
const bool inElu = false,
const bool inSsnu = false,
const bool inElsu = false)
: nbParticles(inNbParticles), boxWidth(1.0), centerOfBox(0,0,0), nu(inNu),
snu(inSnu), su(inSu), elu(inElu), ssnu(inSsnu), elsu(inElsu) {
srand48(static_cast<unsigned int>(0));
if( !nu && !snu && !su && !elu && !ssnu && !elsu ){
std::cout << "UNIFORM" << std::endl;
}
else if( snu ){
std::cout << "slightly NON UNIFORM" << std::endl;
}
else if( su ){
std::cout << "SPHERICAL UNIFORM" << std::endl;
}
else if( elu ){
std::cout << "ELLIPSE UNIFORM" << std::endl;
}
else if( elsu ){
std::cout << "ELLIPSE NON UNIFORM" << std::endl;
initRotationMatrix();
}
else if( ssnu ){
std::cout << "spherical Slightly non UNIFORM" << std::endl;
}
else{
std::cout << "NON UNIFORM" << std::endl;
}
}
/**
* Default destructor
*/
virtual ~FSphericalRandomLoader(){
}
/**
* @return true
*/
bool isOpen() const{
return true;
}
/**
* To get the number of particles from this loader
* @param the number of particles the loader can fill
*/
FSize getNumberOfParticles() const{
return FSize(this->nbParticles);
}
/**
* The center of the box
* @return box center
*/
FPoint<FReal> getCenterOfBox() const{
return this->centerOfBox;
}
/**
* The box width
* @return box width
*/
FReal getBoxWidth() const{
return this->boxWidth;
}
/**
* Fill a particle
* @warning to work with the loader, particles has to expose a setPosition method
* @param the particle to fill