Modelib: LagrangianParam.h Source File

Page principale | Hiérarchie des classes | Liste des composants | Liste des fichiers | Composants

# LagrangianParam.h

    00001 #ifndef __MULTLAGRANGE_H
    00002 #define __MULTLAGRANGE_H
    00003
    00004 #include "Config.h"
    00005 #include "Constant.h"
    00006
    00007 class Model; //évite une déclaration cyclique
    00008
    00010
    00011 class LagrangianParam
    00012 {
    00013 protected:
    00014     VarId id;
    00015     Model * model;
    00016
    00017 #ifdef COMPILE_FOR_PYTHON
    00018 public:
    00019   // On redefini nos surcharges d'opérateurs '='
    00020   // pour que le binding soit explicite.
    00021   LagrangianParam & op_Equal_1(float _value) { return this->operator=(_value); }
    00022   LagrangianParam & op_Equal_2(const LagrangianParam &_l) { return this->operator=(_l); }
    00023 #endif
    00024
    00025 public:
    00027     LagrangianParam():id(0),model(0) {}
    00028
    00029     LagrangianParam(Model & _model, std::string constraintName );
    00030
    00031     LagrangianParam(Model & ,VarId);
    00032
    00034     LagrangianParam(const LagrangianParam & _n):id( _n.id), model(_n.model)  {}
    00035
    00037     LagrangianParam & operator= (const LagrangianParam & _m)
    00038     {
    00039       model = _m.model;
    00040       id= _m.id;
    00041       return *this;
    00042     }
    00043
    00047     VarId GetId() const { return id;}
    00048
    00052     Model * GetModel() const { return model;}
    00053
    00054     float GetValue() const;
    00055     void SetValue( float );
    00056
    00058     LagrangianParam & operator= (float _value)
    00059     {
    00060         SetValue(_value);
    00061         return *this;
    00062     }
    00063
    00065     LagrangianParam & operator+= (float _value)
    00066     {
    00067         SetValue(_value + GetValue());
    00068         return *this;
    00069     }
    00070
    00072     LagrangianParam & operator-= (float _value)
    00073     {
    00074         SetValue( GetValue() - _value);
    00075         return *this;
    00076     }
    00077
    00078     //Destructeur
    00079     ~LagrangianParam() {}
    00080 };
    00081
    00082 #ifdef COMPILE_FOR_PYTHON
    00083         void export_LagrangianParam();
    00084 #endif
    00085
    00086 #endif