<commit_before>/* Siconos-Kernel, Copyright INRIA 2005-2011.
 * Siconos is a program dedicated to modeling, simulation and control
 * of non smooth dynamical systems.
 * Siconos is a free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * Siconos 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Siconos; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Contact: <NAME>, <EMAIL>
*/

/*! \file

Typedef for simulation-related objects
*/

#ifndef SimulationTypedef_H
#define SimulationTypedef_H

#include <vector>
#include <map>
#include <set>

#include "UnitaryRelationsSet.hpp"

#include "SiconosGraph.hpp"
#include "SiconosPointers.hpp"

#include "SiconosProperties.hpp"

/** double precision machine */
/*  eq dlmach('e'),  DBL_EPSILON,  fabs(a-b) <  */
const double MACHINE_PREC = std::numeric_limits<double>::epsilon();


//#include "OneStepIntegrator.hpp"


// ================== Objects to handle DS ==================

/** Map of SiconosMatrix; key = the related DS*/
typedef std::map<SP::DynamicalSystem, SP::SimpleMatrix> MapOfDSMatrices;

/** Iterator through a map of matrices */
typedef MapOfDSMatrices::iterator MatIterator;

/** Const iterator through a map of matrices */
typedef MapOfDSMatrices::const_iterator ConstMatIterator;

/** Map of SiconosVector; key = the related DS*/
typedef std::map<SP::DynamicalSystem, SP::SiconosVector> DSVectors;

/** Iterator through a map of matrices */
typedef DSVectors::iterator DSVectorsIterator;

/** Const iterator through a map of matrices */
typedef DSVectors::const_iterator ConstDSVectorsIterator;

/** Map of double; key = the related DS */
typedef std::map<SP::DynamicalSystem, double> MapOfDouble;

/** Map of double; key = the related DS */
typedef std::map<SP::DynamicalSystem, unsigned  int> DS_int;
TYPEDEF_SPTR(DS_int);

/** Iterator through a map of double */
typedef MapOfDouble::iterator DoubleIterator;

// ================== Objects to handle UnitaryRelations ==================

/** Map of SiconosMatrices with a UnitaryRelations as a key - Used for diagonal unitaryBlock-terms in assembled matrices of LCP etc ...*/
typedef std::map< SP::UnitaryRelation, SP::SiconosMatrix>  MapOfUnitaryMatrices;

/** Iterator through a MapOfUnitaryMatrices */
typedef MapOfUnitaryMatrices::iterator UnitaryMatrixColumnIterator ;

/** Const iterator through a MapOfUnitaryMatrices */
typedef MapOfUnitaryMatrices::const_iterator ConstUnitaryMatrixColumnIterator;

/** Map of MapOfDSUnitaryMatrices with a DynamicalSystem as a key - Used for unitaryBlock-terms indexed by a DynamicalSystem and an UnitaryRelation in assembled matrices of LCP etc ..*/
typedef std::map< SP::DynamicalSystem , MapOfUnitaryMatrices >  MapOfDSMapOfUnitaryMatrices;

/** Iterator through a MapOfDSMapOfUnitaryMatrices */
typedef MapOfDSMapOfUnitaryMatrices::iterator DSUnitaryMatrixRowIterator ;

/** Const iterator through a MapOfDSMapOfUnitaryMatrices */
typedef MapOfDSMapOfUnitaryMatrices::const_iterator ConstDSUnitaryMatrixRowIterator ;




/** Map of MapOfUnitaryMapOfDSMatrices with a DynamicalSystem as a key - Used for unitaryBlock-terms indexed by a DynamicalSystem and an UnitaryRelation in assembled matrices of LCP etc ..*/
typedef std::map< SP::UnitaryRelation , MapOfDSMatrices >  MapOfUnitaryMapOfDSMatrices;

/** Iterator through a MapOfUnitaryMapOfDSMatrices */
typedef MapOfUnitaryMapOfDSMatrices::iterator UnitaryDSMatrixRowIterator ;

/** Const iterator through a MapOfUnitaryMapOfDSMatrices */
typedef MapOfUnitaryMapOfDSMatrices::const_iterator ConstUnitaryDSMatrixRowIterator ;

/** Vector that contains a sequel of sets of UnitaryRelations*/
typedef std::vector< SP::UnitaryRelationsSet > VectorOfSetOfUnitaryRelations;

/** Map to link SP::UnitaryRelation with an int - Used for example in unitaryBlocksPositions for OSNSMatrix */
typedef std::map< SP::UnitaryRelation , unsigned int > UR_int;
TYPEDEF_SPTR(UR_int);

/** list of indices */
typedef std::vector<unsigned int> IndexInt;
TYPEDEF_SPTR(IndexInt);


/** properties that are always needed */
struct RelationProperties
{
  SP::SiconosMatrix block;    // diagonal block
  SP::DynamicalSystem source;
  SP::DynamicalSystem target;
};

struct SystemProperties
{
  SP::SiconosMatrix upper_block;   // i,j block i<j
  SP::SiconosMatrix lower_block;   // i,j block i>j
};

struct GraphProperties
{
  bool symmetric;
};

TYPEDEF_SPTR(GraphProperties);


/** the graph structure :
 *
 * UnitaryRelationsGraph = L(DynamicalSystemsGraph)
 *
 * where L is the line graph
 * transformation */

typedef SiconosGraph < SP::DynamicalSystem, SP::UnitaryRelation,
        SystemProperties , RelationProperties,
        SP::GraphProperties > DynamicalSystemsGraph;

typedef SiconosGraph < SP::UnitaryRelation, SP::DynamicalSystem,
        RelationProperties, SystemProperties,
        SP::GraphProperties > UnitaryRelationsGraph;


TYPEDEF_SPTR(DynamicalSystemsGraph);
TYPEDEF_SPTR(UnitaryRelationsGraph);



/** properties attached only to a graph type (UnitaryRelationsGraph or DynamicalSystemsGraph)
    or optional properties */

INSTALL_PROPERTIES(DynamicalSystemsGraph,
                   ((Vertex, SP::OneStepIntegrator, OSI))); // note : OSI not used at the moment
// always needed -> SystemProperties


INSTALL_PROPERTIES(UnitaryRelationsGraph,
                   ((Vertex, bool, forControl))
                   ((Vertex, SP::SiconosMatrix, blockProj))        // ProjectOnConstraint
                   ((Edge, SP::SiconosMatrix, upper_blockProj))    // idem
                   ((Edge, SP::SiconosMatrix, lower_blockProj)));  // idem


TYPEDEF_SPTR(DynamicalSystemsGraphProperties);
TYPEDEF_SPTR(UnitaryRelationsGraphProperties);<commit_msg>prevent swig to try to understand INSTALL_PROPERTIES (imports in Kernel.i still fail)<commit_after>/* Siconos-Kernel, Copyright INRIA 2005-2011.
 * Siconos is a program dedicated to modeling, simulation and control
 * of non smooth dynamical systems.
 * Siconos is a free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * Siconos 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Siconos; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Contact: <NAME>, <EMAIL>
*/

/*! \file

Typedef for simulation-related objects
*/

#ifndef SimulationTypedef_H
#define SimulationTypedef_H

#include <vector>
#include <map>
#include <set>

#include "UnitaryRelationsSet.hpp"

#include "SiconosGraph.hpp"
#include "SiconosPointers.hpp"

#include "SiconosProperties.hpp"

/** double precision machine */
/*  eq dlmach('e'),  DBL_EPSILON,  fabs(a-b) <  */
const double MACHINE_PREC = std::numeric_limits<double>::epsilon();


//#include "OneStepIntegrator.hpp"


// ================== Objects to handle DS ==================

/** Map of SiconosMatrix; key = the related DS*/
typedef std::map<SP::DynamicalSystem, SP::SimpleMatrix> MapOfDSMatrices;

/** Iterator through a map of matrices */
typedef MapOfDSMatrices::iterator MatIterator;

/** Const iterator through a map of matrices */
typedef MapOfDSMatrices::const_iterator ConstMatIterator;

/** Map of SiconosVector; key = the related DS*/
typedef std::map<SP::DynamicalSystem, SP::SiconosVector> DSVectors;

/** Iterator through a map of matrices */
typedef DSVectors::iterator DSVectorsIterator;

/** Const iterator through a map of matrices */
typedef DSVectors::const_iterator ConstDSVectorsIterator;

/** Map of double; key = the related DS */
typedef std::map<SP::DynamicalSystem, double> MapOfDouble;

/** Map of double; key = the related DS */
typedef std::map<SP::DynamicalSystem, unsigned  int> DS_int;
TYPEDEF_SPTR(DS_int);

/** Iterator through a map of double */
typedef MapOfDouble::iterator DoubleIterator;

// ================== Objects to handle UnitaryRelations ==================

/** Map of SiconosMatrices with a UnitaryRelations as a key - Used for diagonal unitaryBlock-terms in assembled matrices of LCP etc ...*/
typedef std::map< SP::UnitaryRelation, SP::SiconosMatrix>  MapOfUnitaryMatrices;

/** Iterator through a MapOfUnitaryMatrices */
typedef MapOfUnitaryMatrices::iterator UnitaryMatrixColumnIterator ;

/** Const iterator through a MapOfUnitaryMatrices */
typedef MapOfUnitaryMatrices::const_iterator ConstUnitaryMatrixColumnIterator;

/** Map of MapOfDSUnitaryMatrices with a DynamicalSystem as a key - Used for unitaryBlock-terms indexed by a DynamicalSystem and an UnitaryRelation in assembled matrices of LCP etc ..*/
typedef std::map< SP::DynamicalSystem , MapOfUnitaryMatrices >  MapOfDSMapOfUnitaryMatrices;

/** Iterator through a MapOfDSMapOfUnitaryMatrices */
typedef MapOfDSMapOfUnitaryMatrices::iterator DSUnitaryMatrixRowIterator ;

/** Const iterator through a MapOfDSMapOfUnitaryMatrices */
typedef MapOfDSMapOfUnitaryMatrices::const_iterator ConstDSUnitaryMatrixRowIterator ;




/** Map of MapOfUnitaryMapOfDSMatrices with a DynamicalSystem as a key - Used for unitaryBlock-terms indexed by a DynamicalSystem and an UnitaryRelation in assembled matrices of LCP etc ..*/
typedef std::map< SP::UnitaryRelation , MapOfDSMatrices >  MapOfUnitaryMapOfDSMatrices;

/** Iterator through a MapOfUnitaryMapOfDSMatrices */
typedef MapOfUnitaryMapOfDSMatrices::iterator UnitaryDSMatrixRowIterator ;

/** Const iterator through a MapOfUnitaryMapOfDSMatrices */
typedef MapOfUnitaryMapOfDSMatrices::const_iterator ConstUnitaryDSMatrixRowIterator ;

/** Vector that contains a sequel of sets of UnitaryRelations*/
typedef std::vector< SP::UnitaryRelationsSet > VectorOfSetOfUnitaryRelations;

/** Map to link SP::UnitaryRelation with an int - Used for example in unitaryBlocksPositions for OSNSMatrix */
typedef std::map< SP::UnitaryRelation , unsigned int > UR_int;
TYPEDEF_SPTR(UR_int);

/** list of indices */
typedef std::vector<unsigned int> IndexInt;
TYPEDEF_SPTR(IndexInt);


/** properties that are always needed */
struct RelationProperties
{
  SP::SiconosMatrix block;    // diagonal block
  SP::DynamicalSystem source;
  SP::DynamicalSystem target;
};

struct SystemProperties
{
  SP::SiconosMatrix upper_block;   // i,j block i<j
  SP::SiconosMatrix lower_block;   // i,j block i>j
};

struct GraphProperties
{
  bool symmetric;
};

TYPEDEF_SPTR(GraphProperties);


/** the graph structure :
 *
 * UnitaryRelationsGraph = L(DynamicalSystemsGraph)
 *
 * where L is the line graph
 * transformation */

typedef SiconosGraph < SP::DynamicalSystem, SP::UnitaryRelation,
        SystemProperties , RelationProperties,
        SP::GraphProperties > DynamicalSystemsGraph;

typedef SiconosGraph < SP::UnitaryRelation, SP::DynamicalSystem,
        RelationProperties, SystemProperties,
        SP::GraphProperties > UnitaryRelationsGraph;


TYPEDEF_SPTR(DynamicalSystemsGraph);
TYPEDEF_SPTR(UnitaryRelationsGraph);



/** properties attached only to a graph type (UnitaryRelationsGraph or DynamicalSystemsGraph)
    or optional properties */

#ifndef SWIG
INSTALL_PROPERTIES(DynamicalSystemsGraph,
                   ((Vertex, SP::OneStepIntegrator, OSI))); // note : OSI not used at the moment
// always needed -> SystemProperties


INSTALL_PROPERTIES(UnitaryRelationsGraph,
                   ((Vertex, bool, forControl))
                   ((Vertex, SP::SiconosMatrix, blockProj))        // ProjectOnConstraint
                   ((Edge, SP::SiconosMatrix, upper_blockProj))    // idem
                   ((Edge, SP::SiconosMatrix, lower_blockProj)));  // idem

#endif
TYPEDEF_SPTR(DynamicalSystemsGraphProperties);
TYPEDEF_SPTR(UnitaryRelationsGraphProperties);
{'fraction_non_alphanumeric': 0.09917155955923751, 'fraction_numerical': 0.0032172444301455804, 'mean_word_length': 4.980759980759981, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6533306', 'n_tokens_mistral': 3750, 'n_tokens_neox': 3545, 'n_words': 1111}