Skip to content
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(
ViennaRay
LANGUAGES CXX
VERSION 3.6.1)
VERSION 3.7.0)

# --------------------------------------------------------------------------------------------------------
# Library switches
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum
* Installation with CPM

```cmake
CPMAddPackage("gh:viennatools/viennaray@3.6.1")
CPMAddPackage("gh:viennatools/viennaray@3.7.0")
```

* With a local installation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(trench2D LANGUAGES CXX)
project(disk2D LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
target_link_libraries(${PROJECT_NAME} PRIVATE ViennaRay)
Expand Down
14 changes: 8 additions & 6 deletions examples/trench2D/trench2D.cpp → examples/disk2D/disk2D.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <omp.h>
#include <rayParticle.hpp>
#include <rayTrace.hpp>
#include <rayTraceDisk.hpp>

using namespace viennaray;

Expand Down Expand Up @@ -36,9 +36,10 @@ int main() {
// defined, but has to interface the rayParticle<NumericType> class and
// provide the functions: initNew(...), surfaceCollision(...),
// surfaceReflection(...).
auto particle = std::make_unique<TestParticle<NumericType>>();
auto particle =
std::make_unique<DiffuseParticle<NumericType, D>>(0.5, "flux");

Trace<NumericType, D> rayTracer;
TraceDisk<NumericType, D> rayTracer;
rayTracer.setGeometry(points, normals, gridDelta);
rayTracer.setBoundaryConditions(boundaryConds);
rayTracer.setParticleType(particle);
Expand All @@ -51,9 +52,10 @@ int main() {
rayTracer.apply();

// Extract the normalized hit counts for each geometry point
auto normalizedFlux = rayTracer.getNormalizedFlux(NormalizationType::SOURCE);
rayInternal::writeVTK<NumericType, D>("trenchResult.vtk", points,
normalizedFlux);
auto &flux = rayTracer.getLocalData().getVectorData("flux");
rayTracer.normalizeFlux(flux, NormalizationType::SOURCE);

rayInternal::writeVTK<NumericType, D>("trenchResult.vtk", points, flux);

return 0;
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(trench LANGUAGES CXX)
project(disk3D LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
target_link_libraries(${PROJECT_NAME} PRIVATE ViennaRay)
Expand Down
21 changes: 15 additions & 6 deletions examples/trench/trench.cpp → examples/disk3D/disk3D.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <omp.h>
#include <rayParticle.hpp>
#include <rayTrace.hpp>
#include <rayTraceDisk.hpp>

#include <vcTimer.hpp>

using namespace viennaray;

Expand Down Expand Up @@ -37,9 +39,10 @@ int main() {
// defined, but has to interface the rayParticle<NumericType> class and
// provide the functions: initNew(...), surfaceCollision(...),
// surfaceReflection(...).
auto particle = std::make_unique<TestParticle<NumericType>>();
auto particle =
std::make_unique<DiffuseParticle<NumericType, D>>(0.1, "flux");

Trace<NumericType, D> rayTracer;
TraceDisk<NumericType, D> rayTracer;
rayTracer.setGeometry(points, normals, gridDelta);
rayTracer.setBoundaryConditions(boundaryConds);
rayTracer.setParticleType(particle);
Expand All @@ -48,12 +51,18 @@ int main() {
rayTracer.setNumberOfRaysPerPoint(2000);

// Run the ray tracer
Timer timer;
timer.start();
rayTracer.apply();
timer.finish();

std::cout << "Tracing time: " << timer.currentDuration / 1e9 << " s\n";

// Extract the normalized hit counts for each geometry point
auto normalizedFlux = rayTracer.getNormalizedFlux(NormalizationType::SOURCE);
rayInternal::writeVTK<NumericType, D>("trenchResult.vtk", points,
normalizedFlux);
auto &flux = rayTracer.getLocalData().getVectorData("flux");
rayTracer.normalizeFlux(flux, NormalizationType::SOURCE);

rayInternal::writeVTK<NumericType, D>("trenchResult.vtk", points, flux);

return 0;
}
File renamed without changes.
8 changes: 8 additions & 0 deletions examples/triangle3D/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
project(triangle3D LANGUAGES CXX)

add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp")
target_link_libraries(${PROJECT_NAME} PRIVATE ViennaRay)
configure_file(${CMAKE_SOURCE_DIR}/gpu/examples/Resources/trenchMesh.dat
${CMAKE_CURRENT_BINARY_DIR}/trenchMesh.dat COPYONLY)

add_dependencies(ViennaRay_Examples ${PROJECT_NAME})
41 changes: 41 additions & 0 deletions examples/triangle3D/triangle3D.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <rayTraceTriangle.hpp>
#include <rayUtil.hpp>

#include <vcTimer.hpp>

#include <omp.h>

using namespace viennaray;

int main() {
omp_set_num_threads(16);
constexpr int D = 3;
using NumericType = float;
Logger::setLogLevel(LogLevel::DEBUG);

std::vector<Vec3D<NumericType>> points;
std::vector<Vec3D<unsigned>> triangles;
NumericType gridDelta;
rayInternal::readMeshFromFile("trenchMesh.dat", gridDelta, points, triangles);

TraceTriangle<NumericType, D> tracer;
tracer.setGeometry(points, triangles, gridDelta);

auto particle =
std::make_unique<DiffuseParticle<NumericType, D>>(0.1, "flux");
tracer.setParticleType(particle);
tracer.setNumberOfRaysPerPoint(2000);

Timer timer;
timer.start();
tracer.apply();
timer.finish();

std::cout << "Tracing time: " << timer.currentDuration / 1e9 << " s\n";

auto &localData = tracer.getLocalData();
tracer.normalizeFlux(localData.getVectorData(0), NormalizationType::SOURCE);

rayInternal::writeVTP("triangleGeometryOutput.vtp", points, triangles,
localData.getVectorData(0));
}
2 changes: 1 addition & 1 deletion gpu/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ configure_file(Resources/trenchMesh.dat ${CMAKE_CURRENT_BINARY_DIR}/trenchMesh.d
add_dependencies(ViennaRay-GPU_Examples ${target_name})

add_gpu_executable(GPU_trenchDisks target_name trenchDisks.cpp)
configure_file(${CMAKE_SOURCE_DIR}/examples/trench/trenchGrid3D.dat
configure_file(${CMAKE_SOURCE_DIR}/examples/disk3D/trenchGrid3D.dat
${CMAKE_CURRENT_BINARY_DIR}/trenchGrid3D.dat COPYONLY)
add_dependencies(ViennaRay-GPU_Examples ${target_name})

Expand Down
11 changes: 7 additions & 4 deletions gpu/examples/trenchTriangles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ int main(int argc, char **argv) {
gpu::Particle<NumericType> particle;
particle.direction = {0.0f, 0.0f, -1.0f};
particle.name = "Particle";
particle.sticking = 1.f;
particle.sticking = 0.1f;
particle.dataLabels = {"particleFlux"};
particle.materialSticking[7] = 1.f;
particle.materialSticking[1] = .1f;
particle.materialSticking[7] = 0.1f;
particle.materialSticking[1] = 1.0f;

std::unordered_map<std::string, unsigned int> pMap = {{"Particle", 0}};
std::vector<gpu::CallableConfig> cMap = {
Expand All @@ -41,7 +41,7 @@ int main(int argc, char **argv) {
tracer.setMaterialIds(materialIds);
tracer.setCallables("CallableWrapper", context->modulePath);
tracer.setParticleCallableMap({pMap, cMap});
tracer.setNumberOfRaysPerPoint(100);
tracer.setNumberOfRaysPerPoint(2000);
tracer.insertNextParticle(particle);
tracer.prepareParticlePrograms();

Expand All @@ -58,6 +58,9 @@ int main(int argc, char **argv) {
std::vector<float> flux(mesh.triangles.size());
tracer.getFlux(flux.data(), 0, 0);

rayInternal::writeVTP("triangleGeometryOutput.vtp", mesh.nodes,
mesh.triangles, flux);

#ifdef COUNT_RAYS
rayCountBuffer.download(&rayCount, 1);
std::cout << "Trace count: " << rayCount << std::endl;
Expand Down
56 changes: 0 additions & 56 deletions gpu/include/raygIndexMap.hpp

This file was deleted.

Loading