Loading...
Searching...
No Matches
samplelossfunction.h
Go to the documentation of this file.
1#ifndef _BBM_SAMPLELOSSFUNCTION_CONCEPT_H_
2#define _BBM_SAMPLELOSSFUNCTION_CONCEPT_H_
3
4#include "concepts/util.h"
5
6#include "bbm/config.h"
7
8/*************************************************************************/
9/*! \file samplelossfunction_concept.h
10
11 \brief sample loss function contract. Sample loss functions are used in sampled loss functions
12
13*************************************************************************/
14
15namespace bbm {
16 namespace concepts {
17
18 /********************************************************************/
19 /* ! \brief samplelossfunction concept
20
21 A sample loss function computes the loss over a single sample:
22 + concepts::has_config
23 + Value operator()(const Vec3d& in, const Vec3d& out, const Spectrum& value, const Spectrum& reference) const
24 + the result of the operator() must support addition
25
26 *********************************************************************/
27 template<typename SAMPLELOSS>
28 concept samplelossfunction = requires(const SAMPLELOSS& loss)
29 {
31
32 { loss(std::declval<Vec3d_t<SAMPLELOSS>>(), std::declval<Vec3d_t<SAMPLELOSS>>(), std::declval<Spectrum_t<SAMPLELOSS>>(), std::declval<Spectrum_t<SAMPLELOSS>>()) } -> std::same_as<Value_t<SAMPLELOSS>>;
34 };
35
36 /********************************************************************/
37 /*! \brief samplelossfunction archetype for concept checking
38
39 \tparam CONF = config to check for. Default = archetype::config
40 *********************************************************************/
41 namespace archetype {
42 template<typename CONF=config> requires concepts::config<CONF>
44 {
45 using Config = CONF;
46 Value_t<Config> operator()(const Vec3d_t<Config>&, const Vec3d_t<Config>&, const Spectrum_t<Config>&, const Spectrum_t<Config>&) const;
47 };
48 } // end archetype namespace
49
51
52 } // end concepts namespace
53} // end bbm namespace
54
55#endif /* _BBM_SAMPLELOSSFUNCTION_CONCEPT_H_ */
All BBM methods are defined to operate on a variety of value types and spectrum types....
config concept
Definition: config.h:31
Definition: util.h:52
has_config
Definition: config.h:53
loss concept
Definition: loss.h:29
Definition: samplelossfunction.h:28
#define BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept with bbm::concepts::archetypes in the namespace.
Definition: macro.h:35
Definition: aggregatebsdf.h:29
typename get_config< T >::Value Value_t
Definition: config.h:67
typename get_config< T >::Spectrum Spectrum_t
Definition: config.h:68
Definition: samplelossfunction.h:44
Value_t< Config > operator()(const Vec3d_t< Config > &, const Vec3d_t< Config > &, const Spectrum_t< Config > &, const Spectrum_t< Config > &) const
CONF Config
Definition: samplelossfunction.h:45
Additional basic helper concepts.