1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PlaneGCSSolver_Storage.h
4 // Created: 14 Dec 2015
5 // Author: Artem ZHIDKOV
7 #ifndef PlaneGCSSolver_Storage_H_
8 #define PlaneGCSSolver_Storage_H_
10 #include <PlaneGCSSolver_Defs.h>
11 #include <SketchSolver_Storage.h>
13 class PlaneGCSSolver_EntityBuilder;
15 /** \class PlaneGCSSolver_Storage
17 * \brief Contains all necessary data in PlaneGCS format to solve a single group of constraints
19 class PlaneGCSSolver_Storage : public SketchSolver_Storage
22 PlaneGCSSolver_Storage(const SolverPtr& theSolver);
24 // ============= Inherited from SketchSolver_Storage =============
26 /// \brief Change mapping between constraint from SketchPlugin and
27 /// a constraint applicable for corresponding solver.
28 /// \param theConstraint [in] original SketchPlugin constraint
29 /// \param theSolverConstraint [in] solver's constraint
30 virtual void addConstraint(ConstraintPtr theConstraint,
31 ConstraintWrapperPtr theSolverConstraint);
33 /// \brief Add list of temporary constraints which will be destroyed
34 /// after the next solving of the set of constraints.
35 /// \param theSolverConstraint [in] solver's constraint
36 virtual void addTemporaryConstraint(const ConstraintWrapperPtr& theSolverConstraint);
39 /// \brief Convert feature to the form applicable for specific solver and map it
40 /// \param theFeature [in] feature to convert
41 /// \param theForce [in] forced feature creation
42 /// \return \c true if the feature has been created or updated
43 virtual bool update(FeaturePtr theFeature, bool theForce = false);
45 /// \brief Convert attribute to the form applicable for specific solver and map it
46 /// \param theAttribute [in] attribute to convert
47 /// \param theForce [in] forced feature creation
48 /// \return \c true if the attribute has been created or updated
49 virtual bool update(AttributePtr theAttribute, bool theForce = false);
52 /// \brief Removes constraint from the storage
53 /// \return \c true if the constraint and all its parameters are removed successfully
54 virtual bool removeConstraint(ConstraintPtr theConstraint);
56 /// \brief Update SketchPlugin features after resolving constraints
57 virtual void refresh() const;
59 /// \brief Initialize memory for new solver's parameter
60 double* createParameter();
61 /// \brief Release memory occupied by parameters
62 void removeParameters(const GCS::SET_pD& theParams);
64 /// \brief Remove all features became invalid
65 virtual void removeInvalidEntities();
68 /// \brief Convert feature using specified builder.
69 EntityWrapperPtr createFeature(const FeaturePtr& theFeature,
70 PlaneGCSSolver_EntityBuilder* theBuilder);
72 /// \brief Convert attribute using specified builder.
73 EntityWrapperPtr createAttribute(const AttributePtr& theAttribute,
74 PlaneGCSSolver_EntityBuilder* theBuilder);
77 ConstraintID myConstraintLastID; ///< identifier of last added constraint
79 /// additional constraints for correct processing of the arcs
80 std::map<EntityWrapperPtr, ConstraintWrapperPtr> myArcConstraintMap;
82 /// list of removed constraints to notify solver
83 std::list<GCSConstraintPtr> myRemovedConstraints;