Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
SimpleCsvOutputService.cc
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/* SimpleCsvOutputService.cc (C) 2000-2022 */
9/* */
10/* Service allowing the construction and output of a table in CSV format. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/std/SimpleCsvOutputService.h"
15
16/*---------------------------------------------------------------------------*/
17/*---------------------------------------------------------------------------*/
18
19namespace Arcane
20{
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
26init()
27{
28 if (m_with_option && options()->getTableName() != "") {
29 return init(options()->getTableName());
30 }
31 return init("Table_P@proc_id@");
32}
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
38init(const String& table_name)
39{
40 if (m_with_option) {
41 return init(table_name, options()->getTableDir());
42 }
43 return init(table_name, "");
44}
45
46/*---------------------------------------------------------------------------*/
47/*---------------------------------------------------------------------------*/
48
50init(const String& table_name, const String& directory_name)
51{
52 if (!m_is_already_init) {
53 m_is_already_init = true;
54
55 m_internal = makeRef(new SimpleTableInternal(mesh()->parallelMng()));
56 m_simple_csv_reader_writer = makeRef(new SimpleCsvReaderWriter(m_internal));
57
58 m_simple_table_internal_mng.setInternal(m_internal);
59 m_simple_table_output_mng.setReaderWriter(m_simple_csv_reader_writer);
60 }
61 return m_simple_table_output_mng.init(subDomain()->exportDirectory(), table_name, directory_name);
62}
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
68clear()
69{
70 if (m_is_already_init) {
71 m_simple_table_internal_mng.clearInternal();
72 }
73}
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
79writeFile(const String& directory, Integer rank)
80{
81 m_simple_table_output_mng.setOutputDirectory(directory);
82 return m_simple_table_output_mng.writeFile(rank);
83}
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88ARCANE_REGISTER_SERVICE_SIMPLECSVOUTPUT(SimpleCsvOutput, SimpleCsvOutputService);
89
91 ServiceProperty("SimpleCsvOutput", ST_SubDomain),
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
96
97} // End namespace Arcane
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
#define ARCANE_SERVICE_INTERFACE(ainterface)
Macro to declare an interface when registering a service.
CaseOptionsSimpleCsvOutput * options() const
Options du jeu de données du service.
Interface representing a simple table output.
Service creation properties.
void clear() override
Method to clear the tables.
bool writeFile(Integer rank) override
Method allowing writing the array to a file. Method performing collective operations....
bool init() override
Method to initialize the table.
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro for registering a service.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
@ ST_SubDomain
The service is used at the subdomain level.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.
Structure representing a simple table.