Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
OutputChecker.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* OutputChecker.h (C) 2000-2025 */
9/* */
10/* Outputs based on time (physical or CPU) or a number of iterations. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_OUTPUTCHECKER_H
13#define ARCANE_CORE_OUTPUTCHECKER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18
19#include "arcane/core/VariableTypes.h"
20#include "arcane/core/CaseOptions.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31/*!
32 * \brief Manages outputs based on physical time, CPU time, or
33 * a number of iterations.
34 *
35 * CPU time is expressed in minutes.
36 */
37class ARCANE_CORE_EXPORT OutputChecker
38{
39 public:
40
41 //! Output type
43 {
44 OutTypeNone, //!< No outputs
45 OutTypeGlobalTime, //!< Output based on physical time
46 OutTypeCPUTime, //!< Output based on consumed CPU time
47 OutTypeIteration //!< Output based on number of iterations
48 };
49
50 public:
51
52 OutputChecker(ISubDomain* sd, const String& name);
53
54 public:
55
56 void initialize();
57 void initialize(bool recompute_next_value);
58 bool hasOutput() const { return m_out_type != OutTypeNone; }
59 bool check(Real old_time, Real current_time, Integer current_iteration,
60 Integer current_cpu_time, const String& from_function = String());
61 void assignGlobalTime(VariableScalarReal* variable, const CaseOptionReal* option);
62 void assignCPUTime(VariableScalarInteger* variable, const CaseOptionInteger* option);
63 void assignIteration(VariableScalarInteger* variable, const CaseOptionInteger* option);
64 Real nextGlobalTime() const;
65 Integer nextIteration() const;
66 Integer nextCPUTime() const;
67
68 private:
69
70 ISubDomain* m_sub_domain = nullptr;
71 String m_name;
72 eOutType m_out_type = OutTypeNone;
73 VariableScalarInteger* m_next_iteration = nullptr; //!< Next save iteration
74 VariableScalarReal* m_next_global_time = nullptr; //!< Physical time of the next save
75 VariableScalarInteger* m_next_cpu_time = nullptr; //!< CPU time of the next save
76 const CaseOptionInteger* m_step_iteration = nullptr;
77 const CaseOptionReal* m_step_global_time = nullptr;
78 const CaseOptionInteger* m_step_cpu_time = nullptr;
79
80 private:
81
82 void _recomputeTypeGlobalTime();
83 void _recomputeTypeCPUTime();
84 void _recomputeTypeIteration();
85};
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90} // namespace Arcane
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
94
95#endif
Interface of the subdomain manager.
Definition ISubDomain.h:75
Manages outputs based on physical time, CPU time, or a number of iterations.
@ OutTypeCPUTime
Output based on consumed CPU time.
@ OutTypeIteration
Output based on number of iterations.
@ OutTypeNone
No outputs.
@ OutTypeGlobalTime
Output based on physical time.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --