tfel
Loading...
Searching...
No Matches
Evaluate.hxx File Reference

This file implements the evaluation of a material property on a batch of points with the primitive of a backend (see MFront/GenericParallel/Batch.hxx). The generated functions only provide the evaluation at one point. More...

#include <array>
#include <limits>
#include <string>
#include <utility>
#include "TFEL/Config/TFELConfig.hxx"
#include "MFront/GenericParallel/Batch.hxx"
#include "MFront/GenericParallelMaterialProperty/MaterialProperty.h"
#include "MFront/GenericParallelMaterialProperty/PointStatus.hxx"

Classes

struct  mfront::gpmp::PointResult
 result of the evaluation of a material property at one point More...
struct  mfront::gpmp::StatisticsHandler
 handler of the statistics of the material properties, given to the primitives of the backends (see MFront/GenericParallel/Batch.hxx). The statistics are analysed by the report function of the material property, which names the check retained at the reported point. More...
struct  mfront::gpmp::PointEvaluator< Evaluation, N >
 function object evaluating a material property at the points of a batch: the arguments are read, the evaluation at one point is called, and the output and the status of the point are written. More...

Namespaces

namespace  mfront
 This namespace contains material used to build the MFront code generator.

Typedefs

using mfront::gpmp::real = mfront_gmp_real
 a simple alias
using mfront::gpmp::size_type = mfront_gmp_size_type
 a simple alias
using mfront::gpmp::BatchStatistics = ::mfront::generic_parallel::BatchStatistics<real>
 statistics of the evaluation of a batch
using mfront::gpmp::BatchExecution = ::mfront::generic_parallel::BatchExecution<Statistics>
 execution of the evaluation of a batch
using mfront::gpmp::ReportFunction = ::mfront_gpmp_ReportPtr
 function reporting the statistics of an evaluation, generated for each material property (<name>_generic_parallel_report)

Functions

TFEL_HOST_DEVICE constexpr BatchStatistics mfront::gpmp::getPointStatistics (const size_type i, const PointStatus &s) noexcept
constexpr void mfront::gpmp::accumulate (Statistics &s, const BatchStatistics &r) noexcept
 accumulate the statistics of a batch
void mfront::gpmp::initialize (OutputStatus &s) noexcept
 initialize an output status: success, no failure, no unreliable result
template<typename Function>
int mfront::gpmp::handleExceptions (OutputStatus *const s, Function &&f) noexcept
 call the body of a generated function (see mfront::generic_parallel::handleExceptions). The output status is complete even if an exception is thrown before the batch data are checked.
template<size_type N>
bool mfront::gpmp::check (OutputStatus &s, const BatchData &d, const std::array< const char *, N > &names, const bool runtime_checks)
 check the data of a batch: number of points, output, arguments
template<typename Evaluation, size_type N, typename Apply>
int mfront::gpmp::evaluateBatch (OutputStatus &s, const BatchData &d, const Evaluation &evaluation, const std::array< const char *, N > &names, const bool runtime_checks, const ReportFunction report_function, const Apply &apply)
 evaluate a material property at the points of a batch with the primitive of a backend. The batch data are checked (see check), and the statistics are reported by the report function of the material property, unless the calling code gave statistics.
template<typename OutputStatus>
int mfront::gpmp::report (OutputStatus &s, const int status, const std::string_view msg) noexcept
 set the status and the error message of an output status

Detailed Description

This file implements the evaluation of a material property on a batch of points with the primitive of a backend (see MFront/GenericParallel/Batch.hxx). The generated functions only provide the evaluation at one point.

Date
09/11/2026

Function Documentation

◆ accumulate()

void mfront::gpmp::accumulate ( Statistics & s,
const BatchStatistics & r )
constexprnoexcept

accumulate the statistics of a batch

Parameters
[in,out]saccumulated statistics
[in]rstatistics of a batch

◆ check()

template<size_type N>
bool mfront::gpmp::check ( OutputStatus & s,
const BatchData & d,
const std::array< const char *, N > & names,
const bool runtime_checks )

check the data of a batch: number of points, output, arguments

Returns
true if the data are valid, otherwise the error is reported in the output status (status -5)
Parameters
[out]soutput status
[in]dbatch data
[in]namesnames of the arguments, for the error messages
[in]runtime_checksif false, the runtime checks are disabled: as with the generic interface, the number of arguments is not checked

◆ evaluateBatch()

template<typename Evaluation, size_type N, typename Apply>
int mfront::gpmp::evaluateBatch ( OutputStatus & s,
const BatchData & d,
const Evaluation & evaluation,
const std::array< const char *, N > & names,
const bool runtime_checks,
const ReportFunction report_function,
const Apply & apply )

evaluate a material property at the points of a batch with the primitive of a backend. The batch data are checked (see check), and the statistics are reported by the report function of the material property, unless the calling code gave statistics.

Template Parameters
Evaluationevaluation at one point (see PointEvaluator)
Nnumber of arguments
Applycallable object such that apply(s, n, e, h, f) applies the function object f at the n points of a batch with the execution e (see BatchExecution) and reports the statistics in the output status s through the handler h (see StatisticsHandler), and returns the status
Parameters
[out]soutput status
[in]dbatch data
[in]evaluationevaluation at one point
[in]namesnames of the arguments, for the error messages
[in]runtime_checksif false, the runtime checks are disabled: the number of arguments is not checked, and the statistics are neither combined nor reported, the evaluation at one point never reporting an event
[in]report_functionreport function of the material property
[in]applyprimitive of the backend
Returns
the status

◆ getPointStatistics()

TFEL_HOST_DEVICE constexpr BatchStatistics mfront::gpmp::getPointStatistics ( const size_type i,
const PointStatus & s )
constexprnoexcept
Returns
the statistics associated with the status of a point
Parameters
[in]iindex of the point
[in]sstatus of the point

◆ handleExceptions()

template<typename Function>
int mfront::gpmp::handleExceptions ( OutputStatus *const s,
Function && f )
noexcept

call the body of a generated function (see mfront::generic_parallel::handleExceptions). The output status is complete even if an exception is thrown before the batch data are checked.

Returns
the status, -5 (invalid argument) if no output status is given
Parameters
[out]soutput status
[in]ffunction

◆ initialize()

void mfront::gpmp::initialize ( OutputStatus & s)
inlinenoexcept

initialize an output status: success, no failure, no unreliable result

Parameters
[out]soutput status

◆ report()

template<typename OutputStatus>
int mfront::generic_parallel::report ( OutputStatus & s,
const int status,
const std::string_view msg )
noexcept

set the status and the error message of an output status

Parameters
[out]soutput status
[in]statusstatus
[in]msgerror message
Returns
the status