Modelib: Fichier source de LagrangianParam.h

Page principale | Liste des namespaces | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de namespace | Membres de classe | Membres de fichier

# LagrangianParam.h

Aller à la documentation de ce fichier.

    00001 /*
    00002     Copyright (c) 2005, Quentin Lequy and Romain Gaucher
    00003     All rights reserved.
    00004
    00005     Redistribution and use in source and binary forms, with or
    00006     without modification, are permitted provided that the following
    00007     conditions are met:
    00008
    00009         * Redistributions of source code must retain the above copyright
    00010           notice, this list of conditions and the following disclaimer.
    00011
    00012         * Redistributions in binary form must reproduce the above copyright
    00013           notice, this list of conditions and the following disclaimer in the
    00014           documentation and/or other materials provided with the distribution.
    00015
    00016         * Neither the name of Quentin Lequy or Romain Gaucher nor the names
    00017           of its contributors may be used to endorse or promote products
    00018           derived from this software without specific prior written permission.
    00019
    00020     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    00021     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00022     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00023     ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    00024     LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00025     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    00026     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
    00027     AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00028     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00029     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00030 */
    00031
    00032 #ifndef __MULTLAGRANGE_H
    00033 #define __MULTLAGRANGE_H
    00034
    00035 #include "Config.h"
    00036 #include "Constant.h"
    00037
    00038 namespace Modelib {
    00039
    00040 class Model; //évite une déclaration cyclique
    00041
    00043
    00044 class LagrangianParam
    00045 {
    00046 protected:
    00047     VarId id;
    00048     Model * model;
    00049
    00050 #ifdef COMPILE_FOR_PYTHON
    00051 public:
    00052   // On redefini nos surcharges d'opérateurs '='
    00053   // pour que le binding soit explicite.
    00054   LagrangianParam & op_Equal_1(float _value) { return this->operator=(_value); }
    00055   LagrangianParam & op_Equal_2(const LagrangianParam &_l) { return this->operator=(_l); }
    00056 #endif
    00057
    00058 public:
    00060     LagrangianParam():id(0),model(0) {}
    00061
    00062     LagrangianParam(Model & _model, std::string constraintName );
    00063
    00064     LagrangianParam(Model & ,VarId);
    00065
    00067     LagrangianParam(const LagrangianParam & _n):id( _n.id), model(_n.model)  {}
    00068
    00070     LagrangianParam & operator= (const LagrangianParam & _m)
    00071     {
    00072       model = _m.model;
    00073       id= _m.id;
    00074       return *this;
    00075     }
    00076
    00080     VarId GetId() const { return id;}
    00081
    00085     Model * GetModel() const { return model;}
    00086
    00087     float GetValue() const;
    00088     void SetValue( float );
    00089
    00091     LagrangianParam & operator= (float _value)
    00092     {
    00093         SetValue(_value);
    00094         return *this;
    00095     }
    00096
    00098     LagrangianParam & operator+= (float _value)
    00099     {
    00100         SetValue(_value + GetValue());
    00101         return *this;
    00102     }
    00103
    00105     LagrangianParam & operator-= (float _value)
    00106     {
    00107         SetValue( GetValue() - _value);
    00108         return *this;
    00109     }
    00110
    00111     //Destructeur
    00112     ~LagrangianParam() {}
    00113 };
    00114
    00115 #ifdef COMPILE_FOR_PYTHON
    00116     void export_LagrangianParam();
    00117 #endif
    00118
    00119 }
    00120
    00121
    00122 #endif