+public:
+ /*!
+ * \brief Creates algorithm
+ * \param hypId - algorithm ID
+ * \param studyId - study ID
+ * \param gen - SMESH_Gen
+ */
+ SMESH_Algo(int hypId, int studyId, SMESH_Gen * gen);
+
+ /*!
+ * \brief Destructor
+ */
+ virtual ~ SMESH_Algo();
+
+ /*!
+ * \brief Saves nothing in a stream
+ * \param save - the stream
+ * \retval std::ostream & - the stream
+ */
+ virtual std::ostream & SaveTo(std::ostream & save);
+
+ /*!
+ * \brief Loads nothing from a stream
+ * \param load - the stream
+ * \retval std::ostream & - the stream
+ */
+ virtual std::istream & LoadFrom(std::istream & load);
+
+ /*!
+ * \brief Returns all types of compatible hypotheses
+ */
+ const std::vector < std::string > & GetCompatibleHypothesis();
+
+ /*!
+ * \brief Check hypothesis definition to mesh a shape
+ * \param aMesh - the mesh
+ * \param aShape - the shape
+ * \param aStatus - check result
+ * \retval bool - true if hypothesis is well defined
+ */
+ virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ SMESH_Hypothesis::Hypothesis_Status& aStatus) = 0;
+ /*!
+ * \brief Computes mesh on a shape
+ * \param aMesh - the mesh
+ * \param aShape - the shape
+ * \retval bool - is a success
+ *
+ * Algorithms that !NeedDiscreteBoundary() || !OnlyUnaryInput() are
+ * to set SMESH_ComputeError returned by SMESH_submesh::GetComputeError()
+ * to report problematic sub-shapes
+ */
+ virtual bool Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) = 0;
+
+ /*!
+ * \brief Computes mesh without geometry
+ * \param aMesh - the mesh
+ * \param aHelper - helper that must be used for adding elements to \aaMesh
+ * \retval bool - is a success
+ *
+ * The method is called if ( !aMesh->HasShapeToMesh() )
+ */
+ virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
+
+ /*!
+ * \brief Sets _computeCanceled to true. It's usage depends on
+ * implementation of a particular mesher.
+ */
+ virtual void CancelCompute();
+
+ /*!
+ * \brief evaluates size of prospective mesh on a shape
+ * \param aMesh - the mesh
+ * \param aShape - the shape
+ * \param aNbElems - prospective number of elements by types
+ * \retval bool - is a success
+ */
+ virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+ MapShapeNbElems& aResMap) = 0;
+
+ /*!
+ * \brief Returns a list of compatible hypotheses used to mesh a shape
+ * \param aMesh - the mesh
+ * \param aShape - the shape
+ * \param ignoreAuxiliary - do not include auxiliary hypotheses in the list
+ * \retval const std::list <const SMESHDS_Hypothesis*> - hypotheses list
+ *
+ * List the hypothesis used by the algorithm associated to the shape.
+ * Hypothesis associated to father shape -are- taken into account (see
+ * GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in
+ * the algorithm. This method could be surcharged by specific algorithms, in
+ * case of several hypothesis simultaneously applicable.
+ */
+ virtual const std::list <const SMESHDS_Hypothesis *> &
+ GetUsedHypothesis(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool ignoreAuxiliary=true);
+ /*!
+ * \brief Returns a list of compatible hypotheses assigned to a shape in a mesh
+ * \param aMesh - the mesh
+ * \param aShape - the shape
+ * \param ignoreAuxiliary - do not include auxiliary hypotheses in the list
+ * \retval const std::list <const SMESHDS_Hypothesis*> - hypotheses list
+ *
+ * List the relevant hypothesis associated to the shape. Relevant hypothesis
+ * have a name (type) listed in the algorithm. Hypothesis associated to
+ * father shape -are not- taken into account (see GetUsedHypothesis)
+ */
+ const list <const SMESHDS_Hypothesis *> &
+ GetAppliedHypothesis(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool ignoreAuxiliary=true);
+ /*!
+ * \brief Make the filter recognize only compatible hypotheses
+ * \param theFilter - the filter to initialize
+ * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
+ * \retval bool - true if the algo has compatible hypotheses
+ */
+ bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
+ const bool ignoreAuxiliary) const;
+ /*!
+ * \brief Just return false as the algorithm does not hold parameters values
+ */
+ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+ /*!
+ * \brief return compute error
+ */
+ SMESH_ComputeErrorPtr GetComputeError() const;
+ /*!
+ * \brief initialize compute error
+ */
+ void InitComputeError();
+
+public:
+ // ==================================================================
+ // Algo features influencing how Compute() is called:
+ // in what turn and with what input shape
+ // ==================================================================
+
+ // SMESH_Hypothesis::GetDim();
+ // 1 - dimention of target mesh
+
+ bool OnlyUnaryInput() const { return _onlyUnaryInput; }
+ // 2 - is collection of tesselatable shapes inacceptable as input;
+ // "collection" means a shape containing shapes of dim equal
+ // to GetDim().
+ // Algo which can process a collection shape should expect
+ // an input temporary shape that is neither MainShape nor
+ // its child.
+
+ bool NeedDiscreteBoundary() const { return _requireDiscreteBoundary; }
+ // 3 - is a Dim-1 mesh prerequisite
+
+ bool NeedShape() const { return _requireShape; }
+ // 4 - is shape existance required