Skip to content

Commit

Permalink
removing warning of convert double to int in ncells bounding box, rem…
Browse files Browse the repository at this point in the history
…oving OMP privates variables, like pointers passing as private variables and this is a warning in MSBuild
  • Loading branch information
fabricix committed Oct 17, 2024
1 parent 215a176 commit 264d6d0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/BodySphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ void BodySphere::create(Mesh& mesh, Material* material) {

// calculate the number of cells in each direction
Vector3i nCellsBoundingBox;
nCellsBoundingBox.x() = std::ceil((maxPoint.x() - minPoint.x()) / cellDimension.x());
nCellsBoundingBox.y() = std::ceil((maxPoint.y() - minPoint.y()) / cellDimension.y());
nCellsBoundingBox.z() = std::ceil((maxPoint.z() - minPoint.z()) / cellDimension.z());
nCellsBoundingBox.x() = static_cast<int>( std::ceil((maxPoint.x() - minPoint.x()) / cellDimension.x()));
nCellsBoundingBox.y() = static_cast<int>( std::ceil((maxPoint.y() - minPoint.y()) / cellDimension.y()));
nCellsBoundingBox.z() = static_cast<int>( std::ceil((maxPoint.z() - minPoint.z()) / cellDimension.z()));

// create the particles within the sphere
for (int i = 0; i < nCellsBoundingBox.x(); ++i) {
Expand Down
4 changes: 2 additions & 2 deletions src/DynamicRelaxation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ double DynamicRelaxation::computeKineticEnergy(vector<Body*>* bodies)
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for reduction(+:currentKineticEnergy) shared(particles) private(bodies, ibody)
#pragma omp parallel for reduction(+:currentKineticEnergy) shared(particles)
for (int i = 0; i < particles->size(); ++i) {

// verify active particle
Expand Down Expand Up @@ -74,7 +74,7 @@ void DynamicRelaxation::setStaticSolution(vector<Body*>* bodies, int loopCounter
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared(particles) private(bodies, ibody)
#pragma omp parallel for shared(particles)
for (int i = 0; i < particles->size(); ++i) {

// verify active particle
Expand Down
2 changes: 1 addition & 1 deletion src/Integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void Integration::nodalMomentum(Mesh* mesh, double dt) {
vector<Node*>* nodes = mesh->getNodes();

// for each node
#pragma omp parallel for shared(nodes, dt) private(mesh)
#pragma omp parallel for shared(nodes, dt)
for (int i = 0; i < nodes->size(); ++i) {

if (!nodes->at(i)->getActive()){ continue; }
Expand Down
1 change: 0 additions & 1 deletion src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ namespace Output{
std::cout << " Time : " << std::setw(8) << std::scientific << std::setprecision(4) << ModelSetup::getTime() << "s" << std::endl;
std::cout << "Time step : " << std::setw(8) << std::scientific << std::setprecision(4) << ModelSetup::getTimeStep() << "s" << std::endl;
std::cout << "Particles : " << Particle::getTotalParticles() << std::endl;
std::cout << " Threads : " << ModelSetup::getThreads() << std::endl;
std::cout << " Results : " << ModelSetup::getResultNum() << std::endl;
}

Expand Down
3 changes: 1 addition & 2 deletions src/SolverExplicitUSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ SolverExplicitUSL::SolverExplicitUSL() : Solver() {}

void SolverExplicitUSL::Solve()
{

// initialize simulation variables
double time = ModelSetup::getTime();
double dt = ModelSetup::getTimeStep();
Expand Down Expand Up @@ -116,4 +115,4 @@ void SolverExplicitUSL::Solve()

// write results series
Output::writeResultsSeries();
}
}
22 changes: 11 additions & 11 deletions src/Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void Update::nodalVelocity(Mesh* mesh) {
vector<Node*>* gNodes = mesh->getNodes();

// for each node
#pragma omp parallel for shared(gNodes) private(mesh)
#pragma omp parallel for shared(gNodes)
for (int i = 0; i < gNodes->size(); ++i)
{
if(!gNodes->at(i)->getActive()){ continue; }
Expand All @@ -31,7 +31,7 @@ void Update::nodalTotalForce(Mesh* mesh) {
vector<Node*>* gNodes = mesh->getNodes();

// for each node
#pragma omp parallel for shared (gNodes) private(mesh)
#pragma omp parallel for shared (gNodes)
for (int i = 0; i < gNodes->size(); ++i) {

if(!gNodes->at(i)->getActive()){ continue; }
Expand All @@ -50,7 +50,7 @@ void Update::resetNodalValues(Mesh* mesh) {
vector<Node*>* gNodes = mesh->getNodes();

// for each node
#pragma omp parallel for shared (gNodes) private(mesh)
#pragma omp parallel for shared (gNodes)
for (int i = 0; i < gNodes->size(); ++i) {

if(!gNodes->at(i)->getActive()){ continue; }
Expand All @@ -69,7 +69,7 @@ void Update::particleDensity(vector<Body*>* bodies) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared (particles) private(bodies, ibody)
#pragma omp parallel for shared (particles)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand All @@ -90,7 +90,7 @@ void Update::particlePorosity(vector<Body*>* bodies) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared (particles) private(bodies, ibody)
#pragma omp parallel for shared (particles)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand All @@ -111,7 +111,7 @@ void Update::particleStress(vector<Body*>* bodies) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared (particles) private(bodies, ibody)
#pragma omp parallel for shared (particles)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand All @@ -132,7 +132,7 @@ void Update::particlePressure(vector<Body*>* bodies, double dt) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared (particles) private(bodies, ibody)
#pragma omp parallel for shared (particles)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand All @@ -158,7 +158,7 @@ void Update::particleVelocity(Mesh* mesh, vector<Body*>* bodies, double dt) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared (particles, nodes, dt) private(mesh, bodies, ibody)
#pragma omp parallel for shared (particles, nodes, dt)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand Down Expand Up @@ -207,7 +207,7 @@ void Update::particleVelocityFluid(Mesh* mesh, vector<Body*>* bodies, double dt)
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared (particles, nodes, dt) private(mesh, bodies, ibody)
#pragma omp parallel for shared (particles, nodes, dt)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand Down Expand Up @@ -256,7 +256,7 @@ void Update::particlePosition(Mesh* mesh, vector<Body*>* bodies, double dt) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared(particles, nodes, dt) private(ibody, bodies, mesh)
#pragma omp parallel for shared(particles, nodes, dt)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand Down Expand Up @@ -628,7 +628,7 @@ void Update::contributionNodes(Mesh* mesh, vector<Body*>* bodies) {
vector<Particle*>* particles = bodies->at(ibody)->getParticles();

// for each particle
#pragma omp parallel for shared(particles, mesh) private(bodies, ibody)
#pragma omp parallel for shared(particles, mesh)
for (int i = 0; i < particles->size(); ++i) {

// only active particle can contribute
Expand Down

0 comments on commit 264d6d0

Please sign in to comment.