/***************************************************************************
 *   Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net>     *
 *                                                                         *
 *   This file is part of the FreeCAD CAx development system.              *
 *                                                                         *
 *   This library is free software; you can redistribute it and/or         *
 *   modify it under the terms of the GNU Library General Public           *
 *   License as published by the Free Software Foundation; either          *
 *   version 2 of the License, or (at your option) any later version.      *
 *                                                                         *
 *   This library  is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU Library General Public License for more details.                  *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this library; see the file COPYING.LIB. If not,    *
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
 *   Suite 330, Boston, MA  02111-1307, USA                                *
 *                                                                         *
 ***************************************************************************/

#include "PreCompiled.h"

// HypothesisPy.h must be included as first file to avoid compiler warning,
// see: https://forum.freecad.org/viewtopic.php?p=633192#p633192
#include "HypothesisPy.h"

#include <SMESH_Version.h>  // needed for SMESH_VERSION_MAJOR

#ifndef _PreComp_
#include <StdMeshers_Arithmetic1D.hxx>
#include <StdMeshers_AutomaticLength.hxx>
#include <StdMeshers_CompositeSegment_1D.hxx>
#include <StdMeshers_Deflection1D.hxx>
#include <StdMeshers_Hexa_3D.hxx>
#include <StdMeshers_LayerDistribution.hxx>
#include <StdMeshers_LengthFromEdges.hxx>
#include <StdMeshers_LocalLength.hxx>
#if SMESH_VERSION_MAJOR <= 9 && SMESH_VERSION_MINOR < 10
#include <StdMeshers_MEFISTO_2D.hxx>
#endif
#include <StdMeshers_MaxElementArea.hxx>
#include <StdMeshers_MaxElementVolume.hxx>
#include <StdMeshers_MaxLength.hxx>
#include <StdMeshers_NotConformAllowed.hxx>
#include <StdMeshers_NumberOfLayers.hxx>
#include <StdMeshers_NumberOfSegments.hxx>
#include <StdMeshers_Prism_3D.hxx>
#include <StdMeshers_ProjectionSource1D.hxx>
#include <StdMeshers_ProjectionSource2D.hxx>
#include <StdMeshers_ProjectionSource3D.hxx>
#include <StdMeshers_Projection_1D.hxx>
#include <StdMeshers_Projection_2D.hxx>
#include <StdMeshers_Projection_3D.hxx>
#include <StdMeshers_QuadranglePreference.hxx>
#include <StdMeshers_Quadrangle_2D.hxx>
#include <StdMeshers_QuadraticMesh.hxx>
#include <StdMeshers_RadialPrism_3D.hxx>
#include <StdMeshers_Regular_1D.hxx>
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
#include <StdMeshers_SegmentLengthAroundVertex.hxx>
#include <StdMeshers_StartEndLength.hxx>
#include <StdMeshers_UseExisting_1D2D.hxx>
#include <sstream>
#endif

#include <Base/Interpreter.h>
#include <Mod/Part/App/TopoShapePy.h>

#include "FemMeshPy.h"


using namespace Fem;

HypothesisPy::HypothesisPy(std::shared_ptr<SMESH_Hypothesis> h)
    : hyp(h)
{}

HypothesisPy::~HypothesisPy() = default;

// ---------------------------------------------------------------------------

template<class T>
void SMESH_HypothesisPy<T>::init_type(PyObject* module)
{
    // you must have overwritten the virtual functions
    SMESH_HypothesisPy<T>::behaviors().supportRepr();
    SMESH_HypothesisPy<T>::behaviors().supportGetattr();
    SMESH_HypothesisPy<T>::behaviors().supportSetattr();
    SMESH_HypothesisPy<T>::behaviors().set_tp_new(PyMake);

    SMESH_HypothesisPy::add_varargs_method("setLibName",
                                           &SMESH_HypothesisPy<T>::setLibName,
                                           "setLibName(String)");
    SMESH_HypothesisPy::add_varargs_method("getLibName",
                                           &SMESH_HypothesisPy<T>::getLibName,
                                           "String getLibName()");
#if SMESH_VERSION_MAJOR < 7
    SMESH_HypothesisPy::add_varargs_method("setParameters",
                                           &SMESH_HypothesisPy<T>::setParameters,
                                           "setParameters(String)");
    SMESH_HypothesisPy::add_varargs_method("getParameters",
                                           &SMESH_HypothesisPy<T>::getParameters,
                                           "String getParameters()");
    SMESH_HypothesisPy::add_varargs_method("setLastParameters",
                                           &SMESH_HypothesisPy<T>::setLastParameters,
                                           "setLastParameters(String)");
    SMESH_HypothesisPy::add_varargs_method("getLastParameters",
                                           &SMESH_HypothesisPy<T>::getLastParameters,
                                           "String getLastParameters()");
    SMESH_HypothesisPy::add_varargs_method("clearParameters",
                                           &SMESH_HypothesisPy<T>::clearParameters,
                                           "clearParameters()");
#endif
    SMESH_HypothesisPy::add_varargs_method("isAuxiliary",
                                           &SMESH_HypothesisPy<T>::isAuxiliary,
                                           "Bool isAuxiliary()");
    SMESH_HypothesisPy::add_varargs_method("setParametersByMesh",
                                           &SMESH_HypothesisPy<T>::setParametersByMesh,
                                           "setParametersByMesh(Mesh,Shape)");
    Base::Interpreter().addType(SMESH_HypothesisPy<T>::behaviors().type_object(),
                                module,
                                SMESH_HypothesisPy<T>::behaviors().getName());
}

template<class T>
SMESH_HypothesisPy<T>::SMESH_HypothesisPy(SMESH_Hypothesis* h)
    : hyp(h)
{}

template<class T>
SMESH_HypothesisPy<T>::~SMESH_HypothesisPy() = default;

template<class T>
Py::Object SMESH_HypothesisPy<T>::getattr(const char* name)
{
    if (strcmp(name, "this") == 0) {
        return Hypothesis(Py::asObject(new HypothesisPy(this->getHypothesis())));
    }
    return Py::PythonExtension<T>::getattr(name);
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::repr()
{
    std::stringstream str;
    str << hyp->GetName() << ", " << hyp->GetID();
    return Py::String(str.str());
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::setLibName(const Py::Tuple& args)
{
    std::string libName = static_cast<std::string>(Py::String(args[0]));
    hypothesis<SMESH_Hypothesis>()->SetLibName(libName.c_str());
    return Py::None();
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::getLibName(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::String(hypothesis<SMESH_Hypothesis>()->GetLibName());
}


template<class T>
Py::Object SMESH_HypothesisPy<T>::setParametersByMesh(const Py::Tuple& args)
{
    PyObject *mesh, *shape;
    if (!PyArg_ParseTuple(args.ptr(),
                          "O!O!",
                          &(Fem::FemMeshPy::Type),
                          &mesh,
                          &(Part::TopoShapePy::Type),
                          &shape)) {
        throw Py::Exception();
    }
    Fem::FemMesh* m = static_cast<Fem::FemMeshPy*>(mesh)->getFemMeshPtr();
    const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape();
    return Py::Boolean(hypothesis<SMESH_Hypothesis>()->SetParametersByMesh(m->getSMesh(), s));
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::isAuxiliary(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Boolean(hypothesis<SMESH_Hypothesis>()->IsAuxiliary());
}

template<class T>
PyObject*
SMESH_HypothesisPy<T>::PyMake(struct _typeobject* /*type*/, PyObject* args, PyObject* /*kwds*/)
{
    int hypId;
    PyObject* obj;
    if (!PyArg_ParseTuple(args, "iO!", &hypId, &(FemMeshPy::Type), &obj)) {
        return nullptr;
    }
    FemMesh* mesh = static_cast<FemMeshPy*>(obj)->getFemMeshPtr();
#if SMESH_VERSION_MAJOR >= 9
    return new T(hypId, mesh->getGenerator());
#else
    return new T(hypId, 1, mesh->getGenerator());
#endif
}

// ---------------------------------------------------------------------------

void StdMeshers_Arithmetic1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Arithmetic1D");
    behaviors().doc("StdMeshers_Arithmetic1D");

    add_varargs_method("setLength", &StdMeshers_Arithmetic1DPy::setLength, "setLength()");
    add_varargs_method("getLength", &StdMeshers_Arithmetic1DPy::getLength, "getLength()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Arithmetic1DPy::StdMeshers_Arithmetic1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Arithmetic1D(hypId, gen))
{}
#else
StdMeshers_Arithmetic1DPy::StdMeshers_Arithmetic1DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Arithmetic1D(hypId, studyId, gen))
{}
#endif

StdMeshers_Arithmetic1DPy::~StdMeshers_Arithmetic1DPy() = default;

Py::Object StdMeshers_Arithmetic1DPy::setLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_Arithmetic1D>()->SetLength((double)Py::Float(args[0]),
                                                     (bool)Py::Boolean(args[1]));
    return Py::None();
}

Py::Object StdMeshers_Arithmetic1DPy::getLength(const Py::Tuple& args)
{
    int start;
    if (!PyArg_ParseTuple(args.ptr(), "i", &start)) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_Arithmetic1D>()->GetLength(start ? true : false));
}

// ---------------------------------------------------------------------------

void StdMeshers_AutomaticLengthPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_AutomaticLength");
    behaviors().doc("StdMeshers_AutomaticLength");

    add_varargs_method("setFineness", &StdMeshers_AutomaticLengthPy::setFineness, "setFineness()");
    add_varargs_method("getFineness", &StdMeshers_AutomaticLengthPy::getFineness, "getFineness()");
    add_varargs_method("getLength", &StdMeshers_AutomaticLengthPy::getLength, "getLength()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_AutomaticLengthPy::StdMeshers_AutomaticLengthPy(int /*hypId*/, SMESH_Gen* /*gen*/)
    : SMESH_HypothesisPyBase(0)
{}
#else
StdMeshers_AutomaticLengthPy::StdMeshers_AutomaticLengthPy(int /*hypId*/,
                                                           int /*studyId*/,
                                                           SMESH_Gen* /*gen*/)
    : SMESH_HypothesisPyBase(nullptr)
{}
#endif

StdMeshers_AutomaticLengthPy::~StdMeshers_AutomaticLengthPy() = default;

Py::Object StdMeshers_AutomaticLengthPy::setFineness(const Py::Tuple& args)
{
    double fine = (double)Py::Float(args[0]);
    hypothesis<StdMeshers_AutomaticLength>()->SetFineness(fine);
    return Py::None();
}

Py::Object StdMeshers_AutomaticLengthPy::getFineness(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_AutomaticLength>()->GetFineness());
}

namespace Py
{
using FemMesh = ExtensionObject<Fem::FemMeshPy>;
using TopoShape = ExtensionObject<Part::TopoShapePy>;
template<>
bool FemMesh::accepts(PyObject* pyob) const
{
    return (pyob && PyObject_TypeCheck(pyob, &(Fem::FemMeshPy::Type)));
}
template<>
bool TopoShape::accepts(PyObject* pyob) const
{
    return (pyob && PyObject_TypeCheck(pyob, &(Part::TopoShapePy::Type)));
}
}  // namespace Py

Py::Object StdMeshers_AutomaticLengthPy::getLength(const Py::Tuple& args)
{
    Py::FemMesh mesh(args[0]);
    Py::Object shape_or_double(args[1]);

    Fem::FemMesh* m = mesh.extensionObject()->getFemMeshPtr();
    if (shape_or_double.type() == Py::Float().type()) {
        double len = (double)Py::Float(shape_or_double);
        return Py::Float(hypothesis<StdMeshers_AutomaticLength>()->GetLength(m->getSMesh(), len));
    }
    else {
        Py::TopoShape shape(shape_or_double);
        const TopoDS_Shape& s = shape.extensionObject()->getTopoShapePtr()->getShape();
        return Py::Float(hypothesis<StdMeshers_AutomaticLength>()->GetLength(m->getSMesh(), s));
    }
}

// ---------------------------------------------------------------------------

void StdMeshers_NotConformAllowedPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_NotConformAllowed");
    behaviors().doc("StdMeshers_NotConformAllowed");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_NotConformAllowedPy::StdMeshers_NotConformAllowedPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_NotConformAllowed(hypId, gen))
{}
#else
StdMeshers_NotConformAllowedPy::StdMeshers_NotConformAllowedPy(int hypId,
                                                               int studyId,
                                                               SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_NotConformAllowed(hypId, studyId, gen))
{}
#endif

StdMeshers_NotConformAllowedPy::~StdMeshers_NotConformAllowedPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_MaxLengthPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_MaxLength");
    behaviors().doc("StdMeshers_MaxLength");

    add_varargs_method("setLength", &StdMeshers_MaxLengthPy::setLength, "setLength()");
    add_varargs_method("getLength", &StdMeshers_MaxLengthPy::getLength, "getLength()");
    add_varargs_method("havePreestimatedLength",
                       &StdMeshers_MaxLengthPy::havePreestimatedLength,
                       "havePreestimatedLength()");
    add_varargs_method("getPreestimatedLength",
                       &StdMeshers_MaxLengthPy::getPreestimatedLength,
                       "getPreestimatedLength()");
    add_varargs_method("setPreestimatedLength",
                       &StdMeshers_MaxLengthPy::setPreestimatedLength,
                       "setPreestimatedLength()");
    add_varargs_method("setUsePreestimatedLength",
                       &StdMeshers_MaxLengthPy::setUsePreestimatedLength,
                       "setUsePreestimatedLength()");
    add_varargs_method("getUsePreestimatedLength",
                       &StdMeshers_MaxLengthPy::getUsePreestimatedLength,
                       "getUsePreestimatedLength()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_MaxLengthPy::StdMeshers_MaxLengthPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MaxLength(hypId, gen))
{}
#else
StdMeshers_MaxLengthPy::StdMeshers_MaxLengthPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MaxLength(hypId, studyId, gen))
{}
#endif

StdMeshers_MaxLengthPy::~StdMeshers_MaxLengthPy() = default;

Py::Object StdMeshers_MaxLengthPy::setLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_MaxLength>()->SetLength((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_MaxLengthPy::getLength(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_MaxLength>()->GetLength());
}

Py::Object StdMeshers_MaxLengthPy::havePreestimatedLength(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Boolean(hypothesis<StdMeshers_MaxLength>()->HavePreestimatedLength());
}

Py::Object StdMeshers_MaxLengthPy::getPreestimatedLength(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_MaxLength>()->GetPreestimatedLength());
}

Py::Object StdMeshers_MaxLengthPy::setPreestimatedLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_MaxLength>()->SetPreestimatedLength((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_MaxLengthPy::setUsePreestimatedLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_MaxLength>()->SetUsePreestimatedLength((bool)Py::Boolean(args[0]));
    return Py::None();
}

Py::Object StdMeshers_MaxLengthPy::getUsePreestimatedLength(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Boolean(hypothesis<StdMeshers_MaxLength>()->GetUsePreestimatedLength());
}

// ---------------------------------------------------------------------------

void StdMeshers_LocalLengthPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_LocalLength");
    behaviors().doc("StdMeshers_LocalLength");

    add_varargs_method("setLength", &StdMeshers_LocalLengthPy::setLength, "setLength()");
    add_varargs_method("getLength", &StdMeshers_LocalLengthPy::getLength, "getLength()");
    add_varargs_method("setPrecision", &StdMeshers_LocalLengthPy::setPrecision, "setPrecision()");
    add_varargs_method("getPrecision", &StdMeshers_LocalLengthPy::getPrecision, "getPrecision()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_LocalLengthPy::StdMeshers_LocalLengthPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_LocalLength(hypId, gen))
{}
#else
StdMeshers_LocalLengthPy::StdMeshers_LocalLengthPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_LocalLength(hypId, studyId, gen))
{}
#endif

StdMeshers_LocalLengthPy::~StdMeshers_LocalLengthPy() = default;

Py::Object StdMeshers_LocalLengthPy::setLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_LocalLength>()->SetLength((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_LocalLengthPy::getLength(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_LocalLength>()->GetLength());
}

Py::Object StdMeshers_LocalLengthPy::setPrecision(const Py::Tuple& args)
{
    hypothesis<StdMeshers_LocalLength>()->SetPrecision((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_LocalLengthPy::getPrecision(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_LocalLength>()->GetPrecision());
}

// ---------------------------------------------------------------------------

void StdMeshers_MaxElementAreaPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_MaxElementArea");
    behaviors().doc("StdMeshers_MaxElementArea");

    add_varargs_method("setMaxArea", &StdMeshers_MaxElementAreaPy::setMaxArea, "setMaxArea()");
    add_varargs_method("getMaxArea", &StdMeshers_MaxElementAreaPy::getMaxArea, "getMaxArea()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_MaxElementAreaPy::StdMeshers_MaxElementAreaPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MaxElementArea(hypId, gen))
{}
#else
StdMeshers_MaxElementAreaPy::StdMeshers_MaxElementAreaPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MaxElementArea(hypId, studyId, gen))
{}
#endif

StdMeshers_MaxElementAreaPy::~StdMeshers_MaxElementAreaPy() = default;

Py::Object StdMeshers_MaxElementAreaPy::setMaxArea(const Py::Tuple& args)
{
    hypothesis<StdMeshers_MaxElementArea>()->SetMaxArea((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_MaxElementAreaPy::getMaxArea(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_MaxElementArea>()->GetMaxArea());
}

// ---------------------------------------------------------------------------

void StdMeshers_QuadranglePreferencePy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_QuadranglePreference");
    behaviors().doc("StdMeshers_QuadranglePreference");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_QuadranglePreferencePy::StdMeshers_QuadranglePreferencePy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_QuadranglePreference(hypId, gen))
{}
#else
StdMeshers_QuadranglePreferencePy::StdMeshers_QuadranglePreferencePy(int hypId,
                                                                     int studyId,
                                                                     SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_QuadranglePreference(hypId, studyId, gen))
{}
#endif

StdMeshers_QuadranglePreferencePy::~StdMeshers_QuadranglePreferencePy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Quadrangle_2DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Quadrangle_2D");
    behaviors().doc("StdMeshers_Quadrangle_2D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Quadrangle_2DPy::StdMeshers_Quadrangle_2DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Quadrangle_2D(hypId, gen))
{}
#else
StdMeshers_Quadrangle_2DPy::StdMeshers_Quadrangle_2DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Quadrangle_2D(hypId, studyId, gen))
{}
#endif

StdMeshers_Quadrangle_2DPy::~StdMeshers_Quadrangle_2DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Regular_1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Regular_1D");
    behaviors().doc("StdMeshers_Regular_1D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Regular_1DPy::StdMeshers_Regular_1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Regular_1D(hypId, gen))
{}
#else
StdMeshers_Regular_1DPy::StdMeshers_Regular_1DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Regular_1D(hypId, studyId, gen))
{}
#endif

StdMeshers_Regular_1DPy::~StdMeshers_Regular_1DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_UseExisting_1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_UseExisting_1D");
    behaviors().doc("StdMeshers_UseExisting_1D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_UseExisting_1DPy::StdMeshers_UseExisting_1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_UseExisting_1D(hypId, gen))
{}
#else
StdMeshers_UseExisting_1DPy::StdMeshers_UseExisting_1DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_UseExisting_1D(hypId, studyId, gen))
{}
#endif

StdMeshers_UseExisting_1DPy::~StdMeshers_UseExisting_1DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_UseExisting_2DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_UseExisting_2D");
    behaviors().doc("StdMeshers_UseExisting_2D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_UseExisting_2DPy::StdMeshers_UseExisting_2DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_UseExisting_2D(hypId, gen))
{}
#else
StdMeshers_UseExisting_2DPy::StdMeshers_UseExisting_2DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_UseExisting_2D(hypId, studyId, gen))
{}
#endif

StdMeshers_UseExisting_2DPy::~StdMeshers_UseExisting_2DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_CompositeSegment_1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_CompositeSegment_1D");
    behaviors().doc("StdMeshers_CompositeSegment_1D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_CompositeSegment_1DPy::StdMeshers_CompositeSegment_1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_CompositeSegment_1D(hypId, gen))
{}
#else
StdMeshers_CompositeSegment_1DPy::StdMeshers_CompositeSegment_1DPy(int hypId,
                                                                   int studyId,
                                                                   SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_CompositeSegment_1D(hypId, studyId, gen))
{}
#endif

StdMeshers_CompositeSegment_1DPy::~StdMeshers_CompositeSegment_1DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Deflection1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Deflection1D");
    behaviors().doc("StdMeshers_Deflection1D");

    add_varargs_method("setDeflection",
                       &StdMeshers_Deflection1DPy::setDeflection,
                       "setDeflection()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Deflection1DPy::StdMeshers_Deflection1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Deflection1D(hypId, gen))
{}
#else
StdMeshers_Deflection1DPy::StdMeshers_Deflection1DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Deflection1D(hypId, studyId, gen))
{}
#endif

StdMeshers_Deflection1DPy::~StdMeshers_Deflection1DPy() = default;

Py::Object StdMeshers_Deflection1DPy::setDeflection(const Py::Tuple& args)
{
    double fine = (double)Py::Float(args[0]);
    hypothesis<StdMeshers_Deflection1D>()->SetDeflection(fine);
    return Py::None();
}

// ---------------------------------------------------------------------------

void StdMeshers_Hexa_3DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Hexa_3D");
    behaviors().doc("StdMeshers_Hexa_3D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Hexa_3DPy::StdMeshers_Hexa_3DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Hexa_3D(hypId, gen))
{}
#else
StdMeshers_Hexa_3DPy::StdMeshers_Hexa_3DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Hexa_3D(hypId, studyId, gen))
{}
#endif

StdMeshers_Hexa_3DPy::~StdMeshers_Hexa_3DPy() = default;


// ---------------------------------------------------------------------------

void StdMeshers_StartEndLengthPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_StartEndLength");
    behaviors().doc("StdMeshers_StartEndLength");
    add_varargs_method("setLength", &StdMeshers_StartEndLengthPy::setLength, "setLength()");
    add_varargs_method("getLength", &StdMeshers_StartEndLengthPy::getLength, "getLength()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_StartEndLengthPy::StdMeshers_StartEndLengthPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_StartEndLength(hypId, gen))
{}
#else
StdMeshers_StartEndLengthPy::StdMeshers_StartEndLengthPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_StartEndLength(hypId, studyId, gen))
{}
#endif

StdMeshers_StartEndLengthPy::~StdMeshers_StartEndLengthPy() = default;

Py::Object StdMeshers_StartEndLengthPy::setLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_StartEndLength>()->SetLength((double)Py::Float(args[0]),
                                                       (bool)Py::Boolean(args[1]));
    return Py::None();
}

Py::Object StdMeshers_StartEndLengthPy::getLength(const Py::Tuple& args)
{
    return Py::Float(
        hypothesis<StdMeshers_StartEndLength>()->GetLength((bool)Py::Boolean(args[0])));
}

// ---------------------------------------------------------------------------

void StdMeshers_SegmentLengthAroundVertexPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_SegmentLengthAroundVertex");
    behaviors().doc("StdMeshers_SegmentLengthAroundVertex");
    add_varargs_method("setLength",
                       &StdMeshers_SegmentLengthAroundVertexPy::setLength,
                       "setLength()");
    add_varargs_method("getLength",
                       &StdMeshers_SegmentLengthAroundVertexPy::getLength,
                       "getLength()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_SegmentLengthAroundVertexPy::StdMeshers_SegmentLengthAroundVertexPy(int hypId,
                                                                               SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_SegmentLengthAroundVertex(hypId, gen))
{}
#else
StdMeshers_SegmentLengthAroundVertexPy::StdMeshers_SegmentLengthAroundVertexPy(int hypId,
                                                                               int studyId,
                                                                               SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_SegmentLengthAroundVertex(hypId, studyId, gen))
{}
#endif

StdMeshers_SegmentLengthAroundVertexPy::~StdMeshers_SegmentLengthAroundVertexPy() = default;

Py::Object StdMeshers_SegmentLengthAroundVertexPy::setLength(const Py::Tuple& args)
{
    hypothesis<StdMeshers_SegmentLengthAroundVertex>()->SetLength((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_SegmentLengthAroundVertexPy::getLength(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_SegmentLengthAroundVertex>()->GetLength());
}

// ---------------------------------------------------------------------------

void StdMeshers_SegmentAroundVertex_0DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_SegmentAroundVertex_0D");
    behaviors().doc("StdMeshers_SegmentAroundVertex_0D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_SegmentAroundVertex_0DPy::StdMeshers_SegmentAroundVertex_0DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_SegmentAroundVertex_0D(hypId, gen))
{}
#else
StdMeshers_SegmentAroundVertex_0DPy::StdMeshers_SegmentAroundVertex_0DPy(int hypId,
                                                                         int studyId,
                                                                         SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_SegmentAroundVertex_0D(hypId, studyId, gen))
{}
#endif

StdMeshers_SegmentAroundVertex_0DPy::~StdMeshers_SegmentAroundVertex_0DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_RadialPrism_3DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_RadialPrism_3D");
    behaviors().doc("StdMeshers_RadialPrism_3D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_RadialPrism_3DPy::StdMeshers_RadialPrism_3DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_RadialPrism_3D(hypId, gen))
{}
#else
StdMeshers_RadialPrism_3DPy::StdMeshers_RadialPrism_3DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_RadialPrism_3D(hypId, studyId, gen))
{}
#endif

StdMeshers_RadialPrism_3DPy::~StdMeshers_RadialPrism_3DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_QuadraticMeshPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_QuadraticMesh");
    behaviors().doc("StdMeshers_QuadraticMesh");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_QuadraticMeshPy::StdMeshers_QuadraticMeshPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_QuadraticMesh(hypId, gen))
{}
#else
StdMeshers_QuadraticMeshPy::StdMeshers_QuadraticMeshPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_QuadraticMesh(hypId, studyId, gen))
{}
#endif

StdMeshers_QuadraticMeshPy::~StdMeshers_QuadraticMeshPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_ProjectionSource3DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_ProjectionSource3D");
    behaviors().doc("StdMeshers_ProjectionSource3D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_ProjectionSource3DPy::StdMeshers_ProjectionSource3DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_ProjectionSource3D(hypId, gen))
{}
#else
StdMeshers_ProjectionSource3DPy::StdMeshers_ProjectionSource3DPy(int hypId,
                                                                 int studyId,
                                                                 SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_ProjectionSource3D(hypId, studyId, gen))
{}
#endif

StdMeshers_ProjectionSource3DPy::~StdMeshers_ProjectionSource3DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_ProjectionSource2DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_ProjectionSource2D");
    behaviors().doc("StdMeshers_ProjectionSource2D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_ProjectionSource2DPy::StdMeshers_ProjectionSource2DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_ProjectionSource2D(hypId, gen))
{}
#else
StdMeshers_ProjectionSource2DPy::StdMeshers_ProjectionSource2DPy(int hypId,
                                                                 int studyId,
                                                                 SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_ProjectionSource2D(hypId, studyId, gen))
{}
#endif

StdMeshers_ProjectionSource2DPy::~StdMeshers_ProjectionSource2DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_ProjectionSource1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_ProjectionSource1D");
    behaviors().doc("StdMeshers_ProjectionSource1D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_ProjectionSource1DPy::StdMeshers_ProjectionSource1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_ProjectionSource1D(hypId, gen))
{}
#else
StdMeshers_ProjectionSource1DPy::StdMeshers_ProjectionSource1DPy(int hypId,
                                                                 int studyId,
                                                                 SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_ProjectionSource1D(hypId, studyId, gen))
{}
#endif

StdMeshers_ProjectionSource1DPy::~StdMeshers_ProjectionSource1DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Projection_3DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Projection_3D");
    behaviors().doc("StdMeshers_Projection_3D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Projection_3DPy::StdMeshers_Projection_3DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Projection_3D(hypId, gen))
{}
#else
StdMeshers_Projection_3DPy::StdMeshers_Projection_3DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Projection_3D(hypId, studyId, gen))
{}
#endif

StdMeshers_Projection_3DPy::~StdMeshers_Projection_3DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Projection_2DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Projection_2D");
    behaviors().doc("StdMeshers_Projection_2D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Projection_2DPy::StdMeshers_Projection_2DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Projection_2D(hypId, gen))
{}
#else
StdMeshers_Projection_2DPy::StdMeshers_Projection_2DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Projection_2D(hypId, studyId, gen))
{}
#endif

StdMeshers_Projection_2DPy::~StdMeshers_Projection_2DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Projection_1DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Projection_1D");
    behaviors().doc("StdMeshers_Projection_1D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Projection_1DPy::StdMeshers_Projection_1DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Projection_1D(hypId, gen))
{}
#else
StdMeshers_Projection_1DPy::StdMeshers_Projection_1DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Projection_1D(hypId, studyId, gen))
{}
#endif

StdMeshers_Projection_1DPy::~StdMeshers_Projection_1DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_Prism_3DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_Prism_3D");
    behaviors().doc("StdMeshers_Prism_3D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_Prism_3DPy::StdMeshers_Prism_3DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Prism_3D(hypId, gen))
{}
#else
StdMeshers_Prism_3DPy::StdMeshers_Prism_3DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_Prism_3D(hypId, studyId, gen))
{}
#endif

StdMeshers_Prism_3DPy::~StdMeshers_Prism_3DPy() = default;

// ---------------------------------------------------------------------------

void StdMeshers_NumberOfSegmentsPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_NumberOfSegments");
    behaviors().doc("StdMeshers_NumberOfSegments");
    add_varargs_method("setNumberOfSegments",
                       &StdMeshers_NumberOfSegmentsPy::setNumSegm,
                       "setNumberOfSegments()");
    add_varargs_method("getNumberOfSegments",
                       &StdMeshers_NumberOfSegmentsPy::getNumSegm,
                       "getNumberOfSegments()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_NumberOfSegmentsPy::StdMeshers_NumberOfSegmentsPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_NumberOfSegments(hypId, gen))
{}
#else
StdMeshers_NumberOfSegmentsPy::StdMeshers_NumberOfSegmentsPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_NumberOfSegments(hypId, studyId, gen))
{}
#endif

StdMeshers_NumberOfSegmentsPy::~StdMeshers_NumberOfSegmentsPy() = default;

Py::Object StdMeshers_NumberOfSegmentsPy::setNumSegm(const Py::Tuple& args)
{
    hypothesis<StdMeshers_NumberOfSegments>()->SetNumberOfSegments((int)Py::Long(args[0]));
    return Py::None();
}

Py::Object StdMeshers_NumberOfSegmentsPy::getNumSegm(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Long(hypothesis<StdMeshers_NumberOfSegments>()->GetNumberOfSegments());
}

// ---------------------------------------------------------------------------

void StdMeshers_NumberOfLayersPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_NumberOfLayers");
    behaviors().doc("StdMeshers_NumberOfLayers");
    add_varargs_method("setNumberOfLayers",
                       &StdMeshers_NumberOfLayersPy::setNumLayers,
                       "setNumberOfLayers()");
    add_varargs_method("getNumberOfLayers",
                       &StdMeshers_NumberOfLayersPy::getNumLayers,
                       "getNumberOfLayers()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_NumberOfLayersPy::StdMeshers_NumberOfLayersPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_NumberOfLayers(hypId, gen))
{}
#else
StdMeshers_NumberOfLayersPy::StdMeshers_NumberOfLayersPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_NumberOfLayers(hypId, studyId, gen))
{}
#endif

StdMeshers_NumberOfLayersPy::~StdMeshers_NumberOfLayersPy() = default;

Py::Object StdMeshers_NumberOfLayersPy::setNumLayers(const Py::Tuple& args)
{
    hypothesis<StdMeshers_NumberOfLayers>()->SetNumberOfLayers((int)Py::Long(args[0]));
    return Py::None();
}

Py::Object StdMeshers_NumberOfLayersPy::getNumLayers(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Long(hypothesis<StdMeshers_NumberOfLayers>()->GetNumberOfLayers());
}

// ---------------------------------------------------------------------------
#if SMESH_VERSION_MAJOR <= 9 && SMESH_VERSION_MINOR < 10
void StdMeshers_MEFISTO_2DPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_MEFISTO_2D");
    behaviors().doc("StdMeshers_MEFISTO_2D");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_MEFISTO_2DPy::StdMeshers_MEFISTO_2DPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MEFISTO_2D(hypId, gen))
{}
#else
StdMeshers_MEFISTO_2DPy::StdMeshers_MEFISTO_2DPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MEFISTO_2D(hypId, studyId, gen))
{}
#endif
StdMeshers_MEFISTO_2DPy::~StdMeshers_MEFISTO_2DPy() = default;
#endif

// ---------------------------------------------------------------------------

void StdMeshers_MaxElementVolumePy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_MaxElementVolume");
    behaviors().doc("StdMeshers_MaxElementVolume");
    add_varargs_method("setMaxVolume",
                       &StdMeshers_MaxElementVolumePy::setMaxVolume,
                       "setMaxVolume()");
    add_varargs_method("getMaxVolume",
                       &StdMeshers_MaxElementVolumePy::getMaxVolume,
                       "getMaxVolume()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_MaxElementVolumePy::StdMeshers_MaxElementVolumePy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MaxElementVolume(hypId, gen))
{}
#else
StdMeshers_MaxElementVolumePy::StdMeshers_MaxElementVolumePy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_MaxElementVolume(hypId, studyId, gen))
{}
#endif

StdMeshers_MaxElementVolumePy::~StdMeshers_MaxElementVolumePy() = default;

Py::Object StdMeshers_MaxElementVolumePy::setMaxVolume(const Py::Tuple& args)
{
    hypothesis<StdMeshers_MaxElementVolume>()->SetMaxVolume((double)Py::Float(args[0]));
    return Py::None();
}

Py::Object StdMeshers_MaxElementVolumePy::getMaxVolume(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Float(hypothesis<StdMeshers_MaxElementVolume>()->GetMaxVolume());
}

// ---------------------------------------------------------------------------

void StdMeshers_LengthFromEdgesPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_LengthFromEdges");
    behaviors().doc("StdMeshers_LengthFromEdges");
    add_varargs_method("setMode", &StdMeshers_LengthFromEdgesPy::setMode, "setMode()");
    add_varargs_method("getMode", &StdMeshers_LengthFromEdgesPy::getMode, "getMode()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_LengthFromEdgesPy::StdMeshers_LengthFromEdgesPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_LengthFromEdges(hypId, gen))
{}
#else
StdMeshers_LengthFromEdgesPy::StdMeshers_LengthFromEdgesPy(int hypId, int studyId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_LengthFromEdges(hypId, studyId, gen))
{}
#endif

StdMeshers_LengthFromEdgesPy::~StdMeshers_LengthFromEdgesPy() = default;

Py::Object StdMeshers_LengthFromEdgesPy::setMode(const Py::Tuple& args)
{
    hypothesis<StdMeshers_LengthFromEdges>()->SetMode((int)Py::Long(args[0]));
    return Py::None();
}

Py::Object StdMeshers_LengthFromEdgesPy::getMode(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::Long(hypothesis<StdMeshers_LengthFromEdges>()->GetMode());
}

// ---------------------------------------------------------------------------

void StdMeshers_LayerDistributionPy::init_type(PyObject* module)
{
    behaviors().name("StdMeshers_LayerDistribution");
    behaviors().doc("StdMeshers_LayerDistribution");
    add_varargs_method("setLayerDistribution",
                       &StdMeshers_LayerDistributionPy::setLayerDistribution,
                       "setLayerDistribution()");
    add_varargs_method("getLayerDistribution",
                       &StdMeshers_LayerDistributionPy::getLayerDistribution,
                       "getLayerDistribution()");
    SMESH_HypothesisPyBase::init_type(module);
}

#if SMESH_VERSION_MAJOR >= 9
StdMeshers_LayerDistributionPy::StdMeshers_LayerDistributionPy(int hypId, SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_LayerDistribution(hypId, gen))
{}
#else
StdMeshers_LayerDistributionPy::StdMeshers_LayerDistributionPy(int hypId,
                                                               int studyId,
                                                               SMESH_Gen* gen)
    : SMESH_HypothesisPyBase(new StdMeshers_LayerDistribution(hypId, studyId, gen))
{}
#endif

StdMeshers_LayerDistributionPy::~StdMeshers_LayerDistributionPy() = default;

Py::Object StdMeshers_LayerDistributionPy::setLayerDistribution(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::None();
}

Py::Object StdMeshers_LayerDistributionPy::getLayerDistribution(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), "")) {
        throw Py::Exception();
    }
    return Py::None();
}
