-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add diffuse and specular default particles (#61)
* Add default diffuse particle class * Fix missing dim in diff reflection * fix missing dim in diffuse particle class * Add specular particle and particle tests * Bump version
- Loading branch information
Showing
5 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
project(particle LANGUAGES CXX) | ||
|
||
add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") | ||
target_link_libraries(${PROJECT_NAME} PRIVATE ViennaRay) | ||
|
||
add_dependencies(ViennaRay_Tests ${PROJECT_NAME}) | ||
add_test(NAME ${PROJECT_NAME} COMMAND $<TARGET_FILE:${PROJECT_NAME}>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <rayParticle.hpp> | ||
#include <rayTrace.hpp> | ||
|
||
#include <vcTestAsserts.hpp> | ||
|
||
namespace viennacore { | ||
|
||
using namespace viennaray; | ||
|
||
template <class NumericType, int D> void RunTest() { | ||
|
||
{ | ||
auto particle = | ||
std::make_unique<DiffuseParticle<NumericType, D>>(1., "test"); | ||
|
||
NumericType sourcePower = particle->getSourceDistributionPower(); | ||
VC_TEST_ASSERT(sourcePower == 1.); | ||
|
||
auto labels = particle->getLocalDataLabels(); | ||
VC_TEST_ASSERT(labels.size() == 1); | ||
VC_TEST_ASSERT(labels[0] == "test"); | ||
|
||
Trace<NumericType, D> tracer; | ||
tracer.setParticleType(particle); | ||
} | ||
|
||
{ | ||
auto particle = | ||
std::make_unique<SpecularParticle<NumericType, D>>(1., 100., "test"); | ||
|
||
NumericType sourcePower = particle->getSourceDistributionPower(); | ||
VC_TEST_ASSERT(sourcePower == 100.); | ||
|
||
auto labels = particle->getLocalDataLabels(); | ||
VC_TEST_ASSERT(labels.size() == 1); | ||
VC_TEST_ASSERT(labels[0] == "test"); | ||
|
||
Trace<NumericType, D> tracer; | ||
tracer.setParticleType(particle); | ||
} | ||
} | ||
|
||
} // namespace viennacore | ||
|
||
int main() { VC_RUN_ALL_TESTS } |