Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #246

Merged
merged 6 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/core/diffusion/euler_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ void EulerGrid::DiffuseWithClosedEdge(double dt) {
#pragma omp simd
for (x = 1; x < nx - 1; x++) {
++c;
++n;
++s;
++b;
++t;

if (y == 0 || y == (ny - 1) || z == 0 || z == (nz - 1)) {
continue;
Expand All @@ -58,11 +54,6 @@ void EulerGrid::DiffuseWithClosedEdge(double dt) {
d * dt * (c1_[b] - 2 * c1_[c] + c1_[t]) * ibl2) *
(1 - mu_);
}
++c;
++n;
++s;
++b;
++t;
} // tile ny
} // tile nz
} // block ny
Expand Down
9 changes: 0 additions & 9 deletions src/core/diffusion/runge_kutta_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ void RungeKuttaGrid::DiffuseWithClosedEdge(double dt) {
#pragma omp simd
for (x = 1; x < nx - 1; x++) {
++c;
++n;
++s;
++b;
++t;

if (y == 0 || y == (ny - 1) || z == 0 || z == (nz - 1)) {
continue;
Expand All @@ -71,11 +67,6 @@ void RungeKuttaGrid::DiffuseWithClosedEdge(double dt) {
c2_[c] = c1_[c] + (k_[1] * h);
}
}
++c;
++n;
++s;
++b;
++t;
} // tile ny
} // tile nz
} // block ny
Expand Down
1 change: 0 additions & 1 deletion src/core/resource_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ void ResourceManager::ForEachAgentParallel(
struct LoadBalanceFunctor : public Functor<void, Iterator<AgentHandle>*> {
bool minimize_memory;
uint64_t offset;
uint64_t offset_in_numa;
uint64_t nid;
std::vector<std::vector<Agent*>>& agents;
std::vector<Agent*>& dest;
Expand Down
3 changes: 0 additions & 3 deletions src/core/util/random.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ template MathArray<int, 2> DistributionRng<int>::Sample2();
// -----------------------------------------------------------------------------
template <typename TSample>
MathArray<TSample, 2> DistributionRng<TSample>::Sample2Impl(TRandom* rng) {
MathArray<TSample, 2> ret;
ret[0] = Sample();
ret[0] = Sample();
return MathArray<TSample, 2>({Sample(), Sample()});
}
template MathArray<double, 2> DistributionRng<double>::Sample2Impl(TRandom*);
Expand Down
45 changes: 26 additions & 19 deletions src/core/visualization/paraview/vtk_diffusion_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// BioDynaMo
#include "core/param/param.h"
#include "core/simulation.h"
#include "core/util/log.h"
#include "core/util/thread_info.h"
#include "core/visualization/paraview/parallel_vti_writer.h"

Expand Down Expand Up @@ -55,27 +56,33 @@ VtkDiffusionGrid::VtkDiffusionGrid(const std::string& name,
}
}

for (uint64_t i = 0; i < data_.size(); ++i) {
// Add attribute data
if (vd->concentration) {
vtkNew<vtkDoubleArray> concentration;
concentration->SetName("Substance Concentration");
concentration_array_idx_ =
data_[i]->GetPointData()->AddArray(concentration.GetPointer());
}
if (vd->gradient) {
vtkNew<vtkDoubleArray> gradient;
gradient->SetName("Diffusion Gradient");
gradient->SetNumberOfComponents(3);
gradient_array_idx_ =
data_[i]->GetPointData()->AddArray(gradient.GetPointer());
// If statement to prevent possible dereferencing of nullptr
if (vd) {
for (uint64_t i = 0; i < data_.size(); ++i) {
// Add attribute data
if (vd->concentration) {
vtkNew<vtkDoubleArray> concentration;
concentration->SetName("Substance Concentration");
concentration_array_idx_ =
data_[i]->GetPointData()->AddArray(concentration.GetPointer());
}
if (vd->gradient) {
vtkNew<vtkDoubleArray> gradient;
gradient->SetName("Diffusion Gradient");
gradient->SetNumberOfComponents(3);
gradient_array_idx_ =
data_[i]->GetPointData()->AddArray(gradient.GetPointer());
}
}
}

if (!param->export_visualization) {
data_description->AddInput(name.c_str());
data_description->GetInputDescriptionByName(name.c_str())
->SetGrid(data_[0]);
if (!param->export_visualization) {
data_description->AddInput(name.c_str());
data_description->GetInputDescriptionByName(name.c_str())
->SetGrid(data_[0]);
}
} else {
Log::Warning("VtkDiffusionGrid::VtkDiffusionGrid", "Variable `name` (",
name, ") not found in `param->visualize_diffusion`.");
}
}

Expand Down