1 // Copyright (C) 2007-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // WARNING: this file is part of the official ICoCo API and should not be modified.
21 // The official version can be found at the following URL:
23 // https://github.com/cea-trust-platform/icoco-coupling
25 #ifndef ICoCoMEDDoubleField_included
26 #define ICoCoMEDDoubleField_included
28 #include "ICoCoField.hxx"
32 class MEDCouplingFieldDouble;
37 /*! @brief Field data stored internally as a MEDCoupling object.
39 * This class is a wrapper around a MEDCoupling::MEDCouplingFieldDouble object, which holds the field data.
40 * In version 2 of ICoCo, MEDCoupling::MEDCouplingFieldDouble objects are not anymore exposed directly into the API
41 * of ICoCo::Problem. The rationale is to make the interface ICoCo::Problem free of external dependencies
42 * (MEDCoupling particularly).
44 * @sa the MEDCoupling documentation, notably the reference counter mechanism used to manage the lifecycle of
45 * MEDCoupling objects.
47 class ICOCO_EXPORT MEDDoubleField : public ICoCo::Field
50 /*! Builds an empty field (internal MEDCoupling object not set).
54 /*! @brief Builds a field and assign its internal MEDCouplingField object.
56 * The name of 'this' is also automatically set the name of the MEDCouplingField object. If 'field' is null
57 * the name is set to the empty string.
59 * @param field MEDCoupling field instance to use for field data. The field reference counter is incremented.
61 MEDDoubleField(MEDCoupling::MEDCouplingFieldDouble* field);
63 /*! @brief Copy construcotr.
65 MEDDoubleField(const MEDDoubleField& field);
67 /*! @brief Assignement operator.
68 * @param field another MEDDoubleField instance. The previous internal MEDCoupling field reference (if any) has
69 * its counter decremented.
71 MEDDoubleField& operator=(const MEDDoubleField& field);
73 /*! @brief Destructor.
75 virtual ~MEDDoubleField();
77 /*! @brief Get the internal MEDCoupling field object.
78 * @return a pointer to the MEDCouplingField object detained by this instance. Note that the corresponding
79 * object should not be deleted, or its reference counter should not be decreased! Doing so will result in an
80 * invalid instance of the current MEDField.
82 MEDCoupling::MEDCouplingFieldDouble *getMCField() const;
84 /*! @brief Set the internal MEDCoupling field object.
86 * Any previously set field is discarded (its reference counter is decreased) and the reference counter of the
87 * field being set is increased.
89 * The name of 'this' is also automatically set the name of the MEDCouplingField object. If 'field' is nullptr
90 * the name is reset to the empty string.
92 * @param field MEDCouplingFieldDouble object to be used.
94 void setMCField(MEDCoupling::MEDCouplingFieldDouble * field);
97 MEDCoupling::MEDCouplingFieldDouble *_field;