Skip to content

Commit

Permalink
Reformat functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bfierz committed Sep 9, 2021
1 parent ecac1d6 commit de9613f
Show file tree
Hide file tree
Showing 99 changed files with 817 additions and 1,190 deletions.
18 changes: 6 additions & 12 deletions src/benchmarks/vcl.math/eigen33_correctness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@
#include "problems.h"

template<typename WideScalar>
void jacobiEig
(
void jacobiEig(
size_t nr_problems,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using real_t = WideScalar;
using matrix3_t = Eigen::Matrix<real_t, 3, 3>;
Expand All @@ -77,13 +75,11 @@ void jacobiEig
}

template<typename WideScalar>
void jacobiEigQuat
(
void jacobiEigQuat(
size_t nr_problems,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using real_t = WideScalar;
using matrix3_t = Eigen::Matrix<real_t, 3, 3>;
Expand Down Expand Up @@ -135,8 +131,7 @@ void SortEigenvalues(Eigen::Matrix<REAL, 3, 1>& A, Eigen::Matrix<REAL, 3, 3>& B)
}

template<typename Scalar>
void checkSolution
(
void checkSolution(
const char* Name,
const char* file,
size_t nr_problems,
Expand All @@ -145,8 +140,7 @@ void checkSolution
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& refUa,
const Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& refSa,
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& resUa,
const Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& resSa
)
const Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& resSa)
{
using scalar_t = Scalar;

Expand Down
24 changes: 8 additions & 16 deletions src/benchmarks/vcl.math/problems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
// VCL
#include <vcl/math/polardecomposition.h>

void createRandomProblems
(
void createRandomProblems(
size_t nr_problems,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R
)
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R)
{
// Random number generator
std::mt19937_64 rng;
Expand All @@ -62,12 +60,10 @@ void createRandomProblems
}
}

void createSymmetricProblems
(
void createSymmetricProblems(
size_t nr_problems,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R
)
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R)
{
// Random number generator
std::mt19937_64 rng;
Expand All @@ -92,14 +88,12 @@ void createSymmetricProblems
}
}

void createRotationProblems
(
void createRotationProblems(
size_t nr_problems,
float max_angle,
float max_compression,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R
)
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R)
{
// Random number generator
std::mt19937_64 rng;
Expand Down Expand Up @@ -141,13 +135,11 @@ void createRotationProblems
}
}

void computeEigenReferenceSolution
(
void computeEigenReferenceSolution(
size_t nr_problems,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& ATA,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& U,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& S
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& S)
{
// Compute reference using Eigen
for (int i = 0; i < static_cast<int>(nr_problems); i++)
Expand Down
24 changes: 8 additions & 16 deletions src/benchmarks/vcl.math/problems.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,25 @@
// VCL
#include <vcl/core/interleavedarray.h>

void createRandomProblems
(
void createRandomProblems(
size_t nr_problems,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R = nullptr
);
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R = nullptr);

void createSymmetricProblems
(
void createSymmetricProblems(
size_t nr_problems,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R = nullptr
);
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R = nullptr);

void createRotationProblems
(
void createRotationProblems(
size_t nr_problems,
float max_angle,
float max_compression,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R = nullptr
);
Vcl::Core::InterleavedArray<float, 3, 3, -1>* R = nullptr);

void computeEigenReferenceSolution
(
void computeEigenReferenceSolution(
size_t nr_problems,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& ATA,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& U,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& S
);
Vcl::Core::InterleavedArray<float, 3, 1, -1>& S);
6 changes: 2 additions & 4 deletions src/benchmarks/vcl.math/rotation33_correctness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@
// Common functions
namespace {
template<typename Scalar>
void checkSolution
(
void checkSolution(
size_t nr_problems,
Scalar tol,
const std::vector<int>& iters,
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& refRa,
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& resRa
)
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& resRa)
{
using Vcl::Mathematics::equal;

Expand Down
30 changes: 10 additions & 20 deletions src/benchmarks/vcl.math/svd33_correctness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@
#include "problems.h"

template<typename Scalar>
void computeReferenceSolution
(
void computeReferenceSolution(
size_t nr_problems,
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& U,
Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& V,
Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& S
)
Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& S)
{
// Compute reference using Eigen
for (size_t i = 0; i < nr_problems; i++)
Expand All @@ -78,15 +76,13 @@ void computeReferenceSolution
}

template<typename WideScalar, typename Func>
void computeSolution
(
void computeSolution(
size_t nr_problems,
Func& func,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resV,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using real_t = WideScalar;
using matrix3_t = Eigen::Matrix<real_t, 3, 3>;
Expand Down Expand Up @@ -115,14 +111,12 @@ void computeSolution
}

#ifdef VCL_CUDA_SUPPORT
void cudaMcAdamsSVD
(
void cudaMcAdamsSVD(
size_t nr_problems,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resV,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using namespace Vcl::Compute::Cuda;

Expand All @@ -139,14 +133,12 @@ void cudaMcAdamsSVD
#endif // defined VCL_CUDA_SUPPORT

#ifdef VCL_OPENCL_SUPPORT
void openCLMcAdamsSVD
(
void openCLMcAdamsSVD(
size_t nr_problems,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resV,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using namespace Vcl::Compute::OpenCL;

Expand All @@ -163,8 +155,7 @@ void openCLMcAdamsSVD
#endif // defined VCL_OPENCL_SUPPORT

template<typename Scalar>
void checkSolution
(
void checkSolution(
const char* Name,
const char* file,
size_t nr_problems,
Expand All @@ -174,8 +165,7 @@ void checkSolution
const Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& refSa,
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& resUa,
const Vcl::Core::InterleavedArray<Scalar, 3, 3, -1>& resVa,
const Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& resSa
)
const Vcl::Core::InterleavedArray<Scalar, 3, 1, -1>& resSa)
{
using scalar_t = Scalar;

Expand Down
12 changes: 4 additions & 8 deletions src/benchmarks/vcl.math/svd33_performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@

#ifdef VCL_CUDA_SUPPORT
template<typename WideScalar>
void perfCudaMcAdamsSVD
(
void perfCudaMcAdamsSVD(
size_t nr_problems,
unsigned int iters,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resV,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using namespace Vcl::Compute::Cuda;

Expand Down Expand Up @@ -98,15 +96,13 @@ void perfCudaMcAdamsSVD

#ifdef VCL_OPENCL_SUPPORT
template<typename WideScalar>
void perfOpenCLMcAdamsSVD
(
void perfOpenCLMcAdamsSVD(
size_t nr_problems,
unsigned int iters,
const Vcl::Core::InterleavedArray<float, 3, 3, -1>& F,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resU,
Vcl::Core::InterleavedArray<float, 3, 3, -1>& resV,
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS
)
Vcl::Core::InterleavedArray<float, 3, 1, -1>& resS)
{
using namespace Vcl::Compute::OpenCL;

Expand Down
6 changes: 2 additions & 4 deletions src/examples/d3d12/gridcube/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,13 @@ class DynamicBoundingGridExample final : public ImGuiApplication
ImGuiApplication::renderFrame(cmd_buffer, rtv, dsv);
}

void renderBoundingBox
(
void renderBoundingBox(
ID3D12GraphicsCommandList* cmd_list,
const Eigen::AlignedBox3f& bb,
unsigned int resolution,
Vcl::Graphics::Runtime::PipelineState* ps,
const Eigen::Matrix4f& M,
const Eigen::Matrix4f& VP
)
const Eigen::Matrix4f& VP)
{
// Configure the layout
cmd_list->SetPipelineState(_boxPipelineState->handle());
Expand Down
19 changes: 8 additions & 11 deletions src/examples/meshviewer/meshview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,11 @@ void FboRenderer::renderHandle(const Eigen::Matrix4f& M)
_posManip->draw(_engine, M * curr_transform->get());
}

void FboRenderer::renderBoundingBox
(
void FboRenderer::renderBoundingBox(
const Eigen::AlignedBox3f& bb,
unsigned int resolution,
unsigned int resolution,
Vcl::ref_ptr<Vcl::Graphics::Runtime::OpenGL::PipelineState> ps,
const Eigen::Matrix4f& M
)
const Eigen::Matrix4f& M)
{
// Configure the layout
_engine->setPipelineState(ps);
Expand Down Expand Up @@ -656,14 +654,13 @@ QPoint MeshView::selectObject(int x, int y)
return { -1, -1 };
}

namespace
{
Eigen::Vector3f computePointForTranslationManipulation
(
namespace {
Eigen::Vector3f computePointForTranslationManipulation(
const Vcl::Graphics::Camera& camera,
const Eigen::Matrix4f& transform,
int axis, int x, int y
)
int axis,
int x,
int y)
{
// Find ray into the scene and compute the target location
const auto line = camera.pickWorldSpace(x, y);
Expand Down
9 changes: 3 additions & 6 deletions src/examples/meshviewer/util/positionmanipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ namespace Vcl { namespace Editor { namespace Util {
void PositionManipulator::drawIds(
Vcl::ref_ptr<Vcl::Graphics::Runtime::GraphicsEngine> engine,
unsigned int id,
const Eigen::Matrix4f& T
)
const Eigen::Matrix4f& T)
{
VclRequire(_opaqueIdPipelineState, "Opaque pipeline state is initialized.");
VclRequire(_transparentIdPipelineState, "Transparent pipeline state is initialized.");
Expand All @@ -166,8 +165,7 @@ namespace Vcl { namespace Editor { namespace Util {

void PositionManipulator::draw(
Vcl::ref_ptr<Vcl::Graphics::Runtime::GraphicsEngine> engine,
const Eigen::Matrix4f& T
)
const Eigen::Matrix4f& T)
{
VclRequire(_opaquePipelineState, "Opaque pipeline state is initialized.");
VclRequire(_transparentPipelineState, "Transparent pipeline state is initialized.");
Expand All @@ -179,8 +177,7 @@ namespace Vcl { namespace Editor { namespace Util {
Vcl::ref_ptr<Vcl::Graphics::Runtime::GraphicsEngine> engine,
const Eigen::Matrix4f& T,
ref_ptr<Vcl::Graphics::Runtime::PipelineState> opaque_ps,
ref_ptr<Vcl::Graphics::Runtime::PipelineState> transparent_ps
)
ref_ptr<Vcl::Graphics::Runtime::PipelineState> transparent_ps)
{
VclRequire(opaque_ps, "Opaque pipeline state is initialized.");
VclRequire(transparent_ps, "Transparent pipeline state is initialized.");
Expand Down
Loading

0 comments on commit de9613f

Please sign in to comment.