TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
ScatterMED.cpp
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16
17#include <ScatterMED.h>
18#include <LireMED.h>
19#include <Domaine.h>
20#include <SFichier.h>
21
22Implemente_instanciable(ScatterMED,"ScatterMED",Scatter);
23// XD scattermed scatter scattermed NO_BRACE This keyword will read the partition of the domain_name domain into a the
24// XD_CONT MED format files file.med created by Medsplitter.
25
26/*! @brief Simple call to: Interprete::printOn(Sortie&)
27 *
28 * @param (Sortie& os) an output stream
29 * @return (Sortie&) the modified output stream
30 */
32{
33 return Scatter::printOn(os);
34}
35
37{
38 return Scatter::readOn(is);
39}
40
41
42/*! @brief Reads the domain from the file named "nomentree", of type LecFicDistribueBin or LecFicDistribue
43 *
44 * (depending on fichier_domaine_format_binaire_)
45 * The legacy format is no longer supported.
46 * Expected format: Domaine::ReadOn
47 * The domain is renamed after the domain (for lance_test_seq_par).
48 *
49 */
51{
52 Nom fichiermed(nomentree);
53 fichiermed.prefix(".med");
54 Nom n(me()+1);
55 fichiermed+=n;
56 fichiermed+=".med";
57 Domaine& dom = domaine();
58 Nom nom_lu(dom.le_nom());
59 nom_lu+="_";
60 nom_lu+=n;
61 LireMED lire_med(fichiermed, nom_lu);
62 lire_med.associer_domaine(dom);
63 lire_med.lire_geom(true);
64
65 // Record which file the domain was read from
66 dom.set_fichier_lu(nomentree);
67
68 // Rename the domain (important for the lml format:
69 // topology name used by lance_test_seq_par)
70 const Nom& nom_dom = dom.le_nom();
71 dom.nommer(nom_dom);
72
73 if (0)
74 {
75 Nom org=("debug.Zones");
76 org=org.nom_me(me());
77 SFichier file_out(org);
78 file_out << dom << finl<<"0 "<<finl;
79 }
80 barrier();
81}
82
void nommer(const Nom &nom) override
Assigns a name to the Objet_U. Virtual method to override.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
void set_fichier_lu(Nom &nom)
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void lire_geom(bool subDom=true)
Definition LireMED.cpp:926
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Inserts _prefix000n (n=me() or nproc()) into a file name (e.g. toto.titi) to produce toto_prefix000n....
Definition Nom.cpp:380
Nom & prefix(const char *const)
Definition Nom.cpp:324
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
Definition Process.cpp:133
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
Definition Process.cpp:122
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
Definition SFichier.h:29
void lire_domaine(Nom &) override
Reads the domain from the file named "nomentree", of type LecFicDistribueBin or LecFicDistribue.
Domaine & domaine()
Returns the associated domain.
Definition Scatter.cpp:74
Base class for output streams.
Definition Sortie.h:52