Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IPostProcessorWriter.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/* IPostProcessorWriter.h (C) 2000-2026 */
9/* */
10/* Interface for a writer for post-processing information. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IPOSTPROCESSORWRITER_H
13#define ARCANE_CORE_IPOSTPROCESSORWRITER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arcane/core/IService.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29class ICaseOptionList;
30class IDataWriter;
31class IMesh;
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
36/*!
37 * \ingroup IO
38 * \brief Interface for a writer for post-processing information.
39 *
40 * The instance must return an IDataWriter (via dataWriter()) to
41 * handle the writing.
42 *
43 * The caller must position the instant fields and start
44 * the writing via the call IVariableMng::writePostProcessing(). For example
45 * \code
46 * IPostProcessorWriter* pp = ...;
47 * pp->setBaseDirectoryName(...);
48 * pp->setTimes(...);
49 * pp->setVariables(...);
50 * pp->setGroups(...);
51 * IVariableMng* vm = ...;
52 * vm->writerPostProcessing(pp);
53 * \endcode
54 *
55 * Before writing the variables, the IVariableMng instance will call
56 * notifyBeginWrite(). After writing, it calls notifyEndWrite().
57 */
58class ARCANE_CORE_EXPORT IPostProcessorWriter
59{
60 public:
61
62 //! Releases resources
63 virtual ~IPostProcessorWriter() = default;
64
65 public:
66
67 //! Constructs the instance
68 virtual void build() = 0;
69
70 public:
71
72 /*!
73 * \brief Returns the writer associated with this post-processor.
74 *
75 * The returned pointer is only valid between calls
76 * to notifyBeginWrite() and notifyEndWrite().
77 */
78 virtual IDataWriter* dataWriter() = 0;
79
80 /*!
81 * \brief Positions the output directory name for files.
82 *
83 * This directory must exist.
84 */
85 virtual void setBaseDirectoryName(const String& dirname) = 0;
86
87 // TODO: Deprecate in 2027: use getBaseDirectoryName() instead
88 //! Name of the output directory for files.
89 virtual const String& baseDirectoryName() = 0;
90
91 //! Name of the output directory for files.
93
94 /*!
95 * \brief Positions the name of the file containing the outputs.
96 *
97 * Not all writers support changing the file name.
98 */
99 virtual void setBaseFileName(const String& filename) = 0;
100
101 // TODO: Deprecate in 2027: use getBaseFileName() instead
102 //! Name of the file containing the outputs.
103 virtual const String& baseFileName() = 0;
104
105 //! Name of the file containing the outputs.
106 virtual String getBaseFileName();
107
108 /*!
109 * \brief Positions the mesh.
110 *
111 * If not overloaded, this method does nothing.
112 *
113 * \deprecated This method is obsolete. It is no longer possible
114 * to change the mesh of a service implementing this interface.
115 * The choice of the mesh is made when creating the service via
116 * ServiceBuilder by passing the desired mesh as an argument.
117 */
118 ARCANE_DEPRECATED_REASON("Y2022: Choose the mesh during service creation via ServiceBuilder")
119 virtual void setMesh(IMesh* mesh);
120
121 //! Positions the list of times
122 virtual void setTimes(ConstArrayView<Real> times) = 0;
123
124 //! List of saved times
125 virtual ConstArrayView<Real> times() = 0;
126
127 //! Positions the list of variables to output
129
130 //! List of variables to save
132
133 /*!
134 * \brief Positions the list of groups to output.
135 *
136 * The collection passed as an argument is cloned.
137 */
139
140 //! List of groups to save
142
143 public:
144
145 //! Notifies that an output is going to be performed with the current parameters.
146 virtual void notifyBeginWrite() = 0;
147
148 //! Notifies that an output has just been performed.
149 virtual void notifyEndWrite() = 0;
150
151 public:
152
153 //! Closes the writer. After closing, it can no longer be used
154 virtual void close() = 0;
155};
156
157/*---------------------------------------------------------------------------*/
158/*---------------------------------------------------------------------------*/
159
160} // namespace Arcane
161
162/*---------------------------------------------------------------------------*/
163/*---------------------------------------------------------------------------*/
164
165#endif
Declarations of Arcane's general types.
Constant view of an array of type T.
Interface for writing variable data.
Definition IDataWriter.h:45
Interface for a writer for post-processing information.
virtual void setVariables(VariableCollection variables)=0
Positions the list of variables to output.
virtual void build()=0
Constructs the instance.
virtual ConstArrayView< Real > times()=0
List of saved times.
virtual VariableCollection variables()=0
List of variables to save.
virtual const String & baseFileName()=0
Name of the file containing the outputs.
virtual IDataWriter * dataWriter()=0
Returns the writer associated with this post-processor.
virtual void notifyEndWrite()=0
Notifies that an output has just been performed.
virtual void setBaseFileName(const String &filename)=0
Positions the name of the file containing the outputs.
virtual String getBaseFileName()
Name of the file containing the outputs.
virtual void notifyBeginWrite()=0
Notifies that an output is going to be performed with the current parameters.
virtual ItemGroupCollection groups()=0
List of groups to save.
virtual void close()=0
Closes the writer. After closing, it can no longer be used.
virtual void setGroups(ItemGroupCollection groups)=0
Positions the list of groups to output.
virtual void setBaseDirectoryName(const String &dirname)=0
Positions the output directory name for files.
virtual ~IPostProcessorWriter()=default
Releases resources.
virtual const String & baseDirectoryName()=0
Name of the output directory for files.
virtual void setMesh(IMesh *mesh)
Positions the mesh.
virtual String getBaseDirectoryName()
Name of the output directory for files.
virtual void setTimes(ConstArrayView< Real > times)=0
Positions the list of times.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< ItemGroup > ItemGroupCollection
Collection of mesh item groups.
double Real
Type representing a real number.