walberla::pe::raytracing::Raytracer Class Reference

#include <Raytracer.h>

Public Types

enum  ReductionMethod { MPI_REDUCE, MPI_GATHER }
 Which method to use when reducing the process-local image to a global one. More...
 
enum  Algorithm { RAYTRACE_HASHGRIDS, RAYTRACE_NAIVE, RAYTRACE_COMPARE_BOTH, RAYTRACE_COMPARE_BOTH_STRICTLY }
 Which algorithm to use when doing ray-object intersection finding. More...
 

Public Member Functions

Constructors
 Raytracer (const shared_ptr< BlockStorage > &forest, const BlockDataID storageID, const shared_ptr< BodyStorage > &globalBodyStorage, const BlockDataID ccdID, uint16_t pixelsHorizontal, uint16_t pixelsVertical, real_t fov_vertical, uint16_t antiAliasFactor, const Vec3 &cameraPosition, const Vec3 &lookAtPoint, const Vec3 &upVector, const Lighting &lighting, const Color &backgroundColor=Color(real_t(0.1), real_t(0.1), real_t(0.1)), const std::function< ShadingParameters(const BodyID)> &bodyToShadingParamsFunc=defaultBodyTypeDependentShadingParams, const std::function< bool(const BodyID)> &isBodyVisibleFunc=defaultIsBodyVisible)
 Instantiation constructor for the Raytracer class. More...
 
 Raytracer (const shared_ptr< BlockStorage > &forest, const BlockDataID storageID, const shared_ptr< BodyStorage > &globalBodyStorage, const BlockDataID ccdID, const Config::BlockHandle &config, const std::function< ShadingParameters(const BodyID)> &bodyToShadingParamsFunction=defaultBodyTypeDependentShadingParams, const std::function< bool(const BodyID)> &isBodyVisibleFunc=defaultIsBodyVisible)
 Instantiation constructor for the Raytracer class using a config object for view setup. More...
 
Get functions
uint16_t getPixelsHorizontal () const
 Returns the horizontal amount of pixels of the generated image. More...
 
uint16_t getPixelsVertical () const
 Returns the vertical amount of pixels of the generated image. More...
 
real_t getFOVVertical () const
 Returns the vertical field-of-view of the camera. More...
 
const Vec3getCameraPosition () const
 Returns the position of the camera in the global world frame. More...
 
const Vec3getLookAtPoint () const
 Returns the point the camera looks at in the global world frame. More...
 
const Vec3getUpVector () const
 Returns the vector indicating the upwards direction of the camera. More...
 
const ColorgetBackgroundColor () const
 Returns the background color of the scene. More...
 
bool getImageOutputEnabled () const
 Returns true if image output to a file is enabled. More...
 
bool getLocalImageOutputEnabled () const
 Returns true if local image output to a file is enabled. More...
 
const std::string & getImageOutputDirectory () const
 Returns the directory where the images will be saved in. More...
 
uint8_t getFilenameTimestepWidth () const
 Returns width of the timestep number in output filenames. More...
 
bool getConfinePlanesToDomain () const
 Returns whether the rendering of planes gets confined in the simulation domain. More...
 
Set functions
void setBackgroundColor (const Color &color)
 Set the background color of the scene. More...
 
void setImageOutputEnabled (const bool enabled)
 Enable / disable outputting images in the specified directory. More...
 
void setLocalImageOutputEnabled (const bool enabled)
 Enable / disable outputting local images in the specified directory. More...
 
void setImageOutputDirectory (const std::string &path)
 Enable / disable outputting images in the specified directory. More...
 
void setFilenameTimestepWidth (uint8_t width)
 Set width of timestep number in output filenames. More...
 
void setRaytracingAlgorithm (Algorithm algorithm)
 Set the algorithm to use while ray tracing. More...
 
void setReductionMethod (ReductionMethod reductionMethod)
 Set the algorithm to use while reducing. More...
 
void setConfinePlanesToDomain (bool confinePlanesToOrigin)
 Set if the rendering of planes should get confined to the simulation domain. More...
 

Private Attributes

Member variables
const shared_ptr< BlockStorageforest_
 The BlockForest the raytracer operates on. More...
 
const BlockDataID storageID_
 The storage ID of the block data storage the raytracer operates on. More...
 
const shared_ptr< BodyStorageglobalBodyStorage_
 The global body storage the raytracer operates on. More...
 
const BlockDataID ccdID_
 The ID of the hash grids block data. More...
 
uint16_t pixelsHorizontal_
 The horizontal amount of pixels of the generated image. More...
 
uint16_t pixelsVertical_
 The vertical amount of pixels of the generated image. More...
 
real_t fov_vertical_
 The vertical field-of-view of the camera. More...
 
uint16_t antiAliasFactor_
 Factor used for oversampling. More...
 
Vec3 cameraPosition_
 The position of the camera in the global world frame. More...
 
Vec3 lookAtPoint_
 The point the camera looks at in the global world frame, marks the center of the view plane. More...
 
Vec3 upVector_
 The vector indicating the upwards direction of the camera. More...
 
Lighting lighting_
 The lighting of the scene. More...
 
Color backgroundColor_
 Background color of the scene. More...
 
bool imageOutputEnabled_
 Enable / disable writing images to file. More...
 
bool localImageOutputEnabled_
 Enable / disable writing images of the local process to file. More...
 
std::string imageOutputDirectory_
 Path to the image output directory. More...
 
uint8_t filenameTimestepWidth_
 Width of the timestep number in output filenames. More...
 
uint8_t filenameRankWidth_
 Width of the mpi rank part in a filename. More...
 
bool confinePlanesToDomain_
 Enable to render only the parts of planes within the simulation domain. More...
 
std::function< ShadingParameters(const BodyID)> bodyToShadingParamsFunc_
 Function which returns a ShadingParameters struct for the specified body. More...
 
std::function< bool(const BodyID)> isBodyVisibleFunc_
 Function which returns a boolean indicating if a given body should be visible in the final image. More...
 
Algorithm raytracingAlgorithm_
 Algorithm to use while intersection testing. More...
 
ReductionMethod reductionMethod_
 Reduction method used for assembling the image from all processes. More...
 
Member variables for raytracing geometry
Vec3 n_
 The normal vector of the viewing plane. More...
 
Vec3 u_
 The vector spanning the viewing plane in the "right direction". More...
 
Vec3 v_
 The vector spanning the viewing plane in the "up direction". More...
 
real_t d_
 The the distance from camera to viewing plane. More...
 
real_t aspectRatio_
 The aspect ratio of the generated image and viewing plane. More...
 
real_t viewingPlaneHeight_
 The viewing plane height in the world frame. More...
 
real_t viewingPlaneWidth_
 The viewing plane width in the world frame. More...
 
Vec3 viewingPlaneOrigin_
 The origin of the viewing plane. More...
 
real_t pixelWidth_
 The width of a pixel of the generated image in the viewing plane. More...
 
real_t pixelHeight_
 The height of a pixel of the generated image in the viewing plane. More...
 
MPI_Op bodyIntersectionInfo_reduction_op
 
MPI_Datatype bodyIntersectionInfo_mpi_type
 

Functions

template<typename BodyTypeTuple >
void generateImage (const size_t timestep, WcTimingTree *tt=NULL)
 Does one raytracing step. More...
 
void setupView_ ()
 Utility function for setting up the view plane and calculating required variables. More...
 
void setupFilenameRankWidth_ ()
 Utility function for initializing the attribute filenameRankWidth. More...
 
void setupMPI_ ()
 Utility function for setting up the MPI datatype and operation. More...
 
void localOutput (const std::vector< BodyIntersectionInfo > &intersectionsBuffer, size_t timestep, WcTimingTree *tt=NULL)
 
void output (const std::vector< BodyIntersectionInfo > &intersectionsBuffer, size_t timestep, WcTimingTree *tt=NULL)
 
std::string getOutputFilename (const std::string &base, size_t timestep, bool isGlobalImage) const
 Generates the filename for output files. More...
 
void writeImageToFile (const std::vector< BodyIntersectionInfo > &intersectionsBuffer, size_t timestep, bool isGlobalImage=false) const
 Writes the image of the current intersection buffer to a file in the image output directory. More...
 
void writeImageToFile (const std::vector< BodyIntersectionInfo > &intersectionsBuffer, const std::string &fileName) const
 Writes the image of the current intersection buffer to a file in the image output directory. More...
 
void syncImageUsingMPIReduce (std::vector< BodyIntersectionInfo > &intersectionsBuffer, WcTimingTree *tt=NULL)
 Conflate the intersectionsBuffer of each process onto the root process using MPI_Reduce. More...
 
void syncImageUsingMPIGather (std::vector< BodyIntersectionInfo > &intersections, std::vector< BodyIntersectionInfo > &intersectionsBuffer, WcTimingTree *tt=NULL)
 Conflate the intersectionsBuffer of each process onto the root process using MPI_Gather. More...
 
bool isPlaneVisible (const PlaneID plane, const Ray &ray) const
 Checks if a plane should get rendered. More...
 
size_t coordinateToArrayIndex (size_t x, size_t y) const
 Converts a coordinate to an array index. More...
 
template<typename BodyTypeTuple >
void traceRayInGlobalBodyStorage (const Ray &ray, BodyID &body_closest, real_t &t_closest, Vec3 &n_closest) const
 Traces a ray in the global body storage and finds the closest ray-body intersection. More...
 
template<typename BodyTypeTuple >
void traceRayNaively (const Ray &ray, BodyID &body_closest, real_t &t_closest, Vec3 &n_closest) const
 Traces a ray naively and finds the closest ray-body intersection. More...
 
template<typename BodyTypeTuple >
void traceRayInHashGrids (const Ray &ray, BodyID &body_closest, real_t &t_closest, Vec3 &n_closest) const
 Traces a ray in the global body storage and finds the closest ray-body intersection. More...
 
Color getColor (const BodyID body, const Ray &ray, real_t t, const Vec3 &n) const
 Computes the color for a certain intersection. More...
 

Member Enumeration Documentation

◆ Algorithm

Which algorithm to use when doing ray-object intersection finding.

Enumerator
RAYTRACE_HASHGRIDS 

Use hashgrids to find ray-body intersections.

RAYTRACE_NAIVE 

Use the brute force approach of checking all objects for intersection testing.

RAYTRACE_COMPARE_BOTH 

Compare both methods and check for pixel errors.

RAYTRACE_COMPARE_BOTH_STRICTLY 

Same as RAYTRACE_COMPARE_BOTH but abort if errors found.

◆ ReductionMethod

Which method to use when reducing the process-local image to a global one.

Enumerator
MPI_REDUCE 

Reduce info from all processes onto root (assembling happens during reduction).

MPI_GATHER 

Gather info from all processes onto root process and assemble global image there.

Constructor & Destructor Documentation

◆ Raytracer() [1/2]

walberla::pe::raytracing::Raytracer::Raytracer ( const shared_ptr< BlockStorage > &  forest,
const BlockDataID  storageID,
const shared_ptr< BodyStorage > &  globalBodyStorage,
const BlockDataID  ccdID,
uint16_t  pixelsHorizontal,
uint16_t  pixelsVertical,
real_t  fov_vertical,
uint16_t  antiAliasFactor,
const Vec3 cameraPosition,
const Vec3 lookAtPoint,
const Vec3 upVector,
const Lighting lighting,
const Color backgroundColor = Color(real_t(0.1), real_t(0.1), real_t(0.1)),
const std::function< ShadingParameters(const BodyID)> &  bodyToShadingParamsFunc = defaultBodyTypeDependentShadingParams,
const std::function< bool(const BodyID)> &  isBodyVisibleFunc = defaultIsBodyVisible 
)
explicit

Instantiation constructor for the Raytracer class.

Parameters
forestBlockForest the raytracer operates on.
storageIDBlock data ID for the storage the raytracer operates on.
globalBodyStoragePointer to the global body storage.
ccdIDBlock data ID for HashGrids.
pixelsHorizontalHorizontal amount of pixels of the generated image.
pixelsVerticalVertical amount of pixels of the generated image.
fov_verticalVertical field-of-view of the camera.
cameraPositionPosition of the camera in the global world frame.
lookAtPointPoint the camera looks at in the global world frame.
upVectorVector indicating the upwards direction of the camera.
backgroundColorBackground color of the scene.
bodyToShadingParamsFuncA function mapping a BodyID to ShadingParameters for this body. This can be used to customize the color and shading of bodies.
isBodyVisibleFuncA function which returns a boolean indicating if a given body should be visible in the final image.

◆ Raytracer() [2/2]

walberla::pe::raytracing::Raytracer::Raytracer ( const shared_ptr< BlockStorage > &  forest,
const BlockDataID  storageID,
const shared_ptr< BodyStorage > &  globalBodyStorage,
const BlockDataID  ccdID,
const Config::BlockHandle config,
const std::function< ShadingParameters(const BodyID)> &  bodyToShadingParamsFunc = defaultBodyTypeDependentShadingParams,
const std::function< bool(const BodyID)> &  isBodyVisibleFunc = defaultIsBodyVisible 
)
explicit

Instantiation constructor for the Raytracer class using a config object for view setup.

Parameters
forestBlockForest the raytracer operates on.
storageIDStorage ID of the block data storage the raytracer operates on.
globalBodyStoragePointer to the global body storage.
ccdIDBlock data ID for HashGrids.
configConfig block for the raytracer.
bodyToShadingParamsFuncA function mapping a BodyID to ShadingParameters for this body. This can be used to customize the color and shading of bodies.
isBodyVisibleFuncA function which returns a boolean indicating if a given body should be visible in the final image.

The config block has to contain image_x (int), image_y (int) and fov_vertical (real, in degrees). Additionally a vector of reals for each of cameraPosition, lookAt and the upVector for the view setup are required. Optional is antiAliasFactor (uint, usually between 1 and 4) for supersampling and backgroundColor (Vec3). For image output after raytracing, set image_output_directory (string); for local image output additionally set local_image_output_enabled (bool) to true. outputFilenameTimestepZeroPadding (int) sets the zero padding for timesteps in output filenames. For the lighting a config block within the Raytracer config block named Lighting has to be defined, information about its contents is in the Lighting class.

Member Function Documentation

◆ coordinateToArrayIndex()

size_t walberla::pe::raytracing::Raytracer::coordinateToArrayIndex ( size_t  x,
size_t  y 
) const
inlineprivate

Converts a coordinate to an array index.

Parameters
xX component of the coordinate.
yY component of the coordinate.
Returns
Array index.

◆ generateImage()

template<typename BodyTypeTuple >
void walberla::pe::raytracing::Raytracer::generateImage ( const size_t  timestep,
WcTimingTree tt = NULL 
)

Does one raytracing step.

Parameters
timestepThe timestep after which the raytracing starts.
Attention
Planes will not get rendered if their normal and the rays direction point in the approximately same direction. See Raytracer::isPlaneVisible() for further information.

◆ getBackgroundColor()

const Color & walberla::pe::raytracing::Raytracer::getBackgroundColor ( ) const
inline

Returns the background color of the scene.

Returns
Color.

Returns the background color of the scene.

◆ getCameraPosition()

const Vec3 & walberla::pe::raytracing::Raytracer::getCameraPosition ( ) const
inline

Returns the position of the camera in the global world frame.

Returns
The position of the camera.

Returns the position of the camera in the global world frame.

◆ getColor()

Color walberla::pe::raytracing::Raytracer::getColor ( const BodyID  body,
const Ray ray,
real_t  t,
const Vec3 n 
) const
inlineprivate

Computes the color for a certain intersection.

Parameters
bodyIntersected body.
RayRay which intersected the body.
tDistance from eye to intersection point.
nIntersection normal at the intersection point.
Returns
Computed color.

◆ getConfinePlanesToDomain()

bool walberla::pe::raytracing::Raytracer::getConfinePlanesToDomain ( ) const
inline

Returns whether the rendering of planes gets confined in the simulation domain.

Returns
True if the rendering of planes gets confined in the simulation domain.

◆ getFilenameTimestepWidth()

uint8_t walberla::pe::raytracing::Raytracer::getFilenameTimestepWidth ( ) const
inline

Returns width of the timestep number in output filenames.

Returns
Width of the timestep part in filenames.

◆ getFOVVertical()

real_t walberla::pe::raytracing::Raytracer::getFOVVertical ( ) const
inline

Returns the vertical field-of-view of the camera.

Returns
The vertical field-of-view of the camera.

◆ getImageOutputDirectory()

const std::string & walberla::pe::raytracing::Raytracer::getImageOutputDirectory ( ) const
inline

Returns the directory where the images will be saved in.

Returns
Path to the image output directory.

◆ getImageOutputEnabled()

bool walberla::pe::raytracing::Raytracer::getImageOutputEnabled ( ) const
inline

Returns true if image output to a file is enabled.

Returns
True if image output enabled, otherwise false.

◆ getLocalImageOutputEnabled()

bool walberla::pe::raytracing::Raytracer::getLocalImageOutputEnabled ( ) const
inline

Returns true if local image output to a file is enabled.

Returns
True if local image output enabled, otherwise false.

◆ getLookAtPoint()

const Vec3 & walberla::pe::raytracing::Raytracer::getLookAtPoint ( ) const
inline

Returns the point the camera looks at in the global world frame.

Returns
The looked at point.

Returns the point the camera looks at in the global world frame, which also marks the center of the view plane.

◆ getOutputFilename()

std::string walberla::pe::raytracing::Raytracer::getOutputFilename ( const std::string &  base,
size_t  timestep,
bool  isGlobalImage 
) const
private

Generates the filename for output files.

Parameters
baseString that precedes the timestap and rank info.
timestepTimestep this image is from.
isGlobalImageWhether this image is the fully stitched together one.

◆ getPixelsHorizontal()

uint16_t walberla::pe::raytracing::Raytracer::getPixelsHorizontal ( ) const
inline

Returns the horizontal amount of pixels of the generated image.

Returns
The horizontal amount of pixels of the generated image.

◆ getPixelsVertical()

uint16_t walberla::pe::raytracing::Raytracer::getPixelsVertical ( ) const
inline

Returns the vertical amount of pixels of the generated image.

Returns
The vertical amount of pixels of the generated image.

◆ getUpVector()

const Vec3 & walberla::pe::raytracing::Raytracer::getUpVector ( ) const
inline

Returns the vector indicating the upwards direction of the camera.

Returns
The upwards vector of the camera.

Returns the vector indicating the upwards direction of the camera.

◆ isPlaneVisible()

bool walberla::pe::raytracing::Raytracer::isPlaneVisible ( const PlaneID  plane,
const Ray ray 
) const
inlineprivate

Checks if a plane should get rendered.

Parameters
planePlane to check for visibility.
rayRay which is intersected with plane.

Checks if a plane should get rendered by comparing the planes normal and the ray direction. If the rays direction vectors projection on the planes normal is positive, the plane is considered invisible.

◆ localOutput()

void walberla::pe::raytracing::Raytracer::localOutput ( const std::vector< BodyIntersectionInfo > &  intersectionsBuffer,
size_t  timestep,
WcTimingTree tt = NULL 
)
private

◆ output()

void walberla::pe::raytracing::Raytracer::output ( const std::vector< BodyIntersectionInfo > &  intersectionsBuffer,
size_t  timestep,
WcTimingTree tt = NULL 
)
private

◆ setBackgroundColor()

void walberla::pe::raytracing::Raytracer::setBackgroundColor ( const Color color)
inline

Set the background color of the scene.

Parameters
colorNew background color.

◆ setConfinePlanesToDomain()

void walberla::pe::raytracing::Raytracer::setConfinePlanesToDomain ( bool  confinePlanesToDomain)
inline

Set if the rendering of planes should get confined to the simulation domain.

Parameters
confinePlanesToOriginTrue if the rendering of planes should get confined to the simulation domain.

◆ setFilenameTimestepWidth()

void walberla::pe::raytracing::Raytracer::setFilenameTimestepWidth ( uint8_t  width)
inline

Set width of timestep number in output filenames.

Parameters
widthWidth of timestep part in a filename.

◆ setImageOutputDirectory()

void walberla::pe::raytracing::Raytracer::setImageOutputDirectory ( const std::string &  path)
inline

Enable / disable outputting images in the specified directory.

Parameters
enabledSet to true / false to enable / disable image output.

◆ setImageOutputEnabled()

void walberla::pe::raytracing::Raytracer::setImageOutputEnabled ( const bool  enabled)
inline

Enable / disable outputting images in the specified directory.

Parameters
enabledSet to true / false to enable / disable image output.

◆ setLocalImageOutputEnabled()

void walberla::pe::raytracing::Raytracer::setLocalImageOutputEnabled ( const bool  enabled)
inline

Enable / disable outputting local images in the specified directory.

Parameters
enabledSet to true / false to enable / disable image output.

◆ setRaytracingAlgorithm()

void walberla::pe::raytracing::Raytracer::setRaytracingAlgorithm ( Algorithm  algorithm)
inline

Set the algorithm to use while ray tracing.

Parameters
algorithmOne of RAYTRACE_HASHGRIDS, RAYTRACE_NAIVE, RAYTRACE_COMPARE_BOTH, RAYTRACE_COMPARE_BOTH_STRICTLY (abort on errors).

◆ setReductionMethod()

void walberla::pe::raytracing::Raytracer::setReductionMethod ( ReductionMethod  reductionMethod)
inline

Set the algorithm to use while reducing.

Parameters
reductionMethodOne of MPI_GATHER or MPI_REDUCE (latter one only works on MPI builds).

◆ setupFilenameRankWidth_()

void walberla::pe::raytracing::Raytracer::setupFilenameRankWidth_ ( )

Utility function for initializing the attribute filenameRankWidth.

◆ setupMPI_()

void walberla::pe::raytracing::Raytracer::setupMPI_ ( )

Utility function for setting up the MPI datatype and operation.

◆ setupView_()

void walberla::pe::raytracing::Raytracer::setupView_ ( )

Utility function for setting up the view plane and calculating required variables.

◆ syncImageUsingMPIGather()

void walberla::pe::raytracing::Raytracer::syncImageUsingMPIGather ( std::vector< BodyIntersectionInfo > &  intersections,
std::vector< BodyIntersectionInfo > &  intersectionsBuffer,
WcTimingTree tt = NULL 
)
private

Conflate the intersectionsBuffer of each process onto the root process using MPI_Gather.

Parameters
intersectionsBufferBuffer containing intersections.
ttOptional TimingTree.

This function conflates the intersectionsBuffer of each process onto the root process using the MPI_Gather routine. It only sends information for hits.

◆ syncImageUsingMPIReduce()

void walberla::pe::raytracing::Raytracer::syncImageUsingMPIReduce ( std::vector< BodyIntersectionInfo > &  intersectionsBuffer,
WcTimingTree tt = NULL 
)
private

Conflate the intersectionsBuffer of each process onto the root process using MPI_Reduce.

Parameters
intersectionsBufferBuffer containing all intersections for entire image (including non-hits).
ttOptional TimingTree.

This function conflates the intersectionsBuffer of each process onto the root process using the MPI_Reduce routine. It requires sending intersection info structs for the entire image instead of only the ones of the hits.

Attention
This function only works on MPI builds due to the explicit usage of MPI routines.

◆ traceRayInGlobalBodyStorage()

template<typename BodyTypeTuple >
void walberla::pe::raytracing::Raytracer::traceRayInGlobalBodyStorage ( const Ray ray,
BodyID body_closest,
real_t t_closest,
Vec3 n_closest 
) const
inlineprivate

Traces a ray in the global body storage and finds the closest ray-body intersection.

Parameters
rayRay which is shot.
body_closestReference where the closest body will be stored in.
t_closestReference where the distance of the currently closest body is stored in, will get updated if closer intersection found.
n_closestReference where the intersection normal will be stored in.

◆ traceRayInHashGrids()

template<typename BodyTypeTuple >
void walberla::pe::raytracing::Raytracer::traceRayInHashGrids ( const Ray ray,
BodyID body_closest,
real_t t_closest,
Vec3 n_closest 
) const
inlineprivate

Traces a ray in the global body storage and finds the closest ray-body intersection.

Parameters
rayRay which is shot.
body_closestReference where the closest body will be stored in.
t_closestReference where the distance of the currently closest body is stored in, will get updated if closer intersection found.
n_closestReference where the intersection normal will be stored in.

◆ traceRayNaively()

template<typename BodyTypeTuple >
void walberla::pe::raytracing::Raytracer::traceRayNaively ( const Ray ray,
BodyID body_closest,
real_t t_closest,
Vec3 n_closest 
) const
inlineprivate

Traces a ray naively and finds the closest ray-body intersection.

Parameters
rayRay which is shot.
body_closestReference where the closest body will be stored in.
t_closestReference where the distance of the currently closest body is stored in, will get updated if closer intersection found.
n_closestReference where the intersection normal will be stored in.

◆ writeImageToFile() [1/2]

void walberla::pe::raytracing::Raytracer::writeImageToFile ( const std::vector< BodyIntersectionInfo > &  intersectionsBuffer,
const std::string &  fileName 
) const
private

Writes the image of the current intersection buffer to a file in the image output directory.

Parameters
intersectionsBufferBuffer with intersection info for each pixel.
fileNameName of the output file.

◆ writeImageToFile() [2/2]

void walberla::pe::raytracing::Raytracer::writeImageToFile ( const std::vector< BodyIntersectionInfo > &  intersectionsBuffer,
size_t  timestep,
bool  isGlobalImage = false 
) const
private

Writes the image of the current intersection buffer to a file in the image output directory.

Parameters
intersectionsBufferBuffer with intersection info for each pixel.
timestepTimestep this image is from.
isGlobalImageWhether this image is the fully stitched together one.

Member Data Documentation

◆ antiAliasFactor_

uint16_t walberla::pe::raytracing::Raytracer::antiAliasFactor_
private

Factor used for oversampling.

Should be between 1 (fast, but jagged edges) and 4 (16 times slower, very smooth edges).

◆ aspectRatio_

real_t walberla::pe::raytracing::Raytracer::aspectRatio_
private

The aspect ratio of the generated image and viewing plane.

◆ backgroundColor_

Color walberla::pe::raytracing::Raytracer::backgroundColor_
private

Background color of the scene.

◆ bodyIntersectionInfo_mpi_type

MPI_Datatype walberla::pe::raytracing::Raytracer::bodyIntersectionInfo_mpi_type
private

◆ bodyIntersectionInfo_reduction_op

MPI_Op walberla::pe::raytracing::Raytracer::bodyIntersectionInfo_reduction_op
private

◆ bodyToShadingParamsFunc_

std::function<ShadingParameters (const BodyID)> walberla::pe::raytracing::Raytracer::bodyToShadingParamsFunc_
private

Function which returns a ShadingParameters struct for the specified body.

◆ cameraPosition_

Vec3 walberla::pe::raytracing::Raytracer::cameraPosition_
private

The position of the camera in the global world frame.

◆ ccdID_

const BlockDataID walberla::pe::raytracing::Raytracer::ccdID_
private

The ID of the hash grids block data.

◆ confinePlanesToDomain_

bool walberla::pe::raytracing::Raytracer::confinePlanesToDomain_
private

Enable to render only the parts of planes within the simulation domain.

◆ d_

real_t walberla::pe::raytracing::Raytracer::d_
private

The the distance from camera to viewing plane.

◆ filenameRankWidth_

uint8_t walberla::pe::raytracing::Raytracer::filenameRankWidth_
private

Width of the mpi rank part in a filename.

◆ filenameTimestepWidth_

uint8_t walberla::pe::raytracing::Raytracer::filenameTimestepWidth_
private

Width of the timestep number in output filenames.

Use e.g. 5 for ranges from 1 to 99 999: Will result in filenames like image_00001.png up to image_99999.png.

◆ forest_

const shared_ptr<BlockStorage> walberla::pe::raytracing::Raytracer::forest_
private

The BlockForest the raytracer operates on.

◆ fov_vertical_

real_t walberla::pe::raytracing::Raytracer::fov_vertical_
private

The vertical field-of-view of the camera.

◆ globalBodyStorage_

const shared_ptr<BodyStorage> walberla::pe::raytracing::Raytracer::globalBodyStorage_
private

The global body storage the raytracer operates on.

◆ imageOutputDirectory_

std::string walberla::pe::raytracing::Raytracer::imageOutputDirectory_
private

Path to the image output directory.

◆ imageOutputEnabled_

bool walberla::pe::raytracing::Raytracer::imageOutputEnabled_
private

Enable / disable writing images to file.

◆ isBodyVisibleFunc_

std::function<bool (const BodyID)> walberla::pe::raytracing::Raytracer::isBodyVisibleFunc_
private

Function which returns a boolean indicating if a given body should be visible in the final image.

◆ lighting_

Lighting walberla::pe::raytracing::Raytracer::lighting_
private

The lighting of the scene.

◆ localImageOutputEnabled_

bool walberla::pe::raytracing::Raytracer::localImageOutputEnabled_
private

Enable / disable writing images of the local process to file.

◆ lookAtPoint_

Vec3 walberla::pe::raytracing::Raytracer::lookAtPoint_
private

The point the camera looks at in the global world frame, marks the center of the view plane.

◆ n_

Vec3 walberla::pe::raytracing::Raytracer::n_
private

The normal vector of the viewing plane.

◆ pixelHeight_

real_t walberla::pe::raytracing::Raytracer::pixelHeight_
private

The height of a pixel of the generated image in the viewing plane.

◆ pixelsHorizontal_

uint16_t walberla::pe::raytracing::Raytracer::pixelsHorizontal_
private

The horizontal amount of pixels of the generated image.

◆ pixelsVertical_

uint16_t walberla::pe::raytracing::Raytracer::pixelsVertical_
private

The vertical amount of pixels of the generated image.

◆ pixelWidth_

real_t walberla::pe::raytracing::Raytracer::pixelWidth_
private

The width of a pixel of the generated image in the viewing plane.

◆ raytracingAlgorithm_

Algorithm walberla::pe::raytracing::Raytracer::raytracingAlgorithm_
private

Algorithm to use while intersection testing.

◆ reductionMethod_

ReductionMethod walberla::pe::raytracing::Raytracer::reductionMethod_
private

Reduction method used for assembling the image from all processes.

◆ storageID_

const BlockDataID walberla::pe::raytracing::Raytracer::storageID_
private

The storage ID of the block data storage the raytracer operates on.

◆ u_

Vec3 walberla::pe::raytracing::Raytracer::u_
private

The vector spanning the viewing plane in the "right direction".

◆ upVector_

Vec3 walberla::pe::raytracing::Raytracer::upVector_
private

The vector indicating the upwards direction of the camera.

◆ v_

Vec3 walberla::pe::raytracing::Raytracer::v_
private

The vector spanning the viewing plane in the "up direction".

◆ viewingPlaneHeight_

real_t walberla::pe::raytracing::Raytracer::viewingPlaneHeight_
private

The viewing plane height in the world frame.

◆ viewingPlaneOrigin_

Vec3 walberla::pe::raytracing::Raytracer::viewingPlaneOrigin_
private

The origin of the viewing plane.

◆ viewingPlaneWidth_

real_t walberla::pe::raytracing::Raytracer::viewingPlaneWidth_
private

The viewing plane width in the world frame.


The documentation for this class was generated from the following files: