#include <Solver.h>
Inheritance diagram for mcSolver:
This is an abstract class which must be used as base class for all the solvers handled by mcMathCore.
Definition at line 64 of file Solver.h.
Public Member Functions | |
mcSolver () | |
virtual | ~mcSolver () |
Getters. | |
Some inlined getters. | |
wxString | math_GetDesc () const |
Returns the description of this solver. | |
wxString | math_GetName () const |
Returns the name of this solver. | |
wxString | math_GetLastErr () const |
Returns the description of the last error after a call to #Solve(). | |
mcSolverType | math_GetType () const |
Returns the type of this solver. | |
Miscellaneous functions. | |
Some various functions. | |
virtual void | data_Check () const |
Checks this solver; an assert should fail if this function finds something wrong. | |
virtual bool | math_PreSolve (const mcMathOrSystem &, mcSystemStepArray &) |
virtual bool | math_PostSolve (const mcMathOrSystem &, mcSystemStepArray &) |
Abstract functions. | |
These are the core of mcSolver-derived classes. | |
virtual bool | math_WorksOn (const mcMathOrSystem &) const =0 |
Returns TRUE if this algorithm can be applied on the given math system solving it for one of the mcSymbol contained registered as unknowns. | |
virtual bool | math_WorksOn (const mcMathOrSystem &, const mcSymbolProperties *unk) const |
Works like math_WorksOn but this overloaded function also takes the symbol which will be used as unknown to solve for. | |
virtual bool | math_Solve (const mcMathOrSystem &, mcSystemStepArray &) |
The most important function: it must apply the algorithm encapsulated in this class to the given math system. | |
virtual bool | math_SolveLine (mcMathLine &, const mcSymbolProperties *unk, mcSystemStepArray &)=0 |
Solves the given mcMathMng object for the given symbol, filling the given mcSystemStepArray with the intermediate resolution steps. | |
virtual bool | math_isReady () const =0 |
Returns TRUE if this solver is ready to work. | |
virtual wxPanel * | gui_GetOptionsPanel () const =0 |
Returns the panel containing the options for this algorithm. | |
Protected Member Functions | |
void | math_ResetUnkArray () |
Sets to NULL the array containing the unknowns. | |
mcSymbolProperties * | math_GetUnknown (const mcMathOrSystem &sys, int n) const |
Returns the n-th unknown symbol found in the given system. | |
void | math_DoSimplifyStep (long lflags, long rflags, mcMathLine &tosimplify, mcSystemStepArray &steps, mcExpSimRes *p=NULL) |
Performs a simplification step on the given system and puts the new step in the given mcSystemStepArray. | |
void | math_DoCompleteSimplification (long lflags, long rflags, mcMathLine &tosimplify, mcSystemStepArray &steps) |
Performs repeated simplification steps until the given system is not completely simplified. | |
void | math_DoExpandStep (long lflags, long rflags, mcMathLine &tosimplify, mcSystemStepArray &steps, mcExpSimRes *p=NULL) |
Like math_DoSimplifyStep but calls mcElementHelpers::math_Expand. | |
void | math_DoCompleteExpansion (long lflags, long rflags, mcMathLine &tosimplify, mcSystemStepArray &steps) |
Like math_DoCompleteSimplification but calls mcElementHelpers::math_Expand. | |
void | math_SplitInTwoEquations (const mcPolynomial &lfirsteq, const mcPolynomial &lseceq, const mcPolynomial &rfirsteq, const mcPolynomial &rseceq, mcSystemStepArray &steps, mcLogicOperator conn=mcLO_OR) |
Creates the solution. | |
void | math_SplitInTwoEquations (mcMathLine *firsteq, mcMathLine *seceq, mcSystemStepArray &steps, mcLogicOperator conn=mcLO_OR) |
void | math_SplitInTwoEquations (const mcMathLine &firsteq, const mcMathLine &seceq, mcSystemStepArray &steps, mcLogicOperator conn=mcLO_OR) |
Protected Attributes | |
mcSolverType | m_nType |
The unique identifier of this solver. | |
wxString | m_strName |
The name of this solver. | |
wxString | m_strDesc |
A short description of this solver. | |
wxString | m_strLastErr |
The description of the last error (if any). | |
mcRealValue | m_fLastLenght |
The lenght value for the last step. | |
const mcSymbolProperties * | m_pUnkArr [mcSOLVER_MAXLINES] |
The unknown respect to the system is being solved. |
|
Definition at line 146 of file Solver.h. References math_ResetUnkArray(). |
|
|
|
Checks this solver; an assert should fail if this function finds something wrong.
Definition at line 203 of file Solver.cpp. References mcASSERT. Referenced by mcSolverArray::data_Check(). |
|
Returns the panel containing the options for this algorithm. The returned pointer must be deleted by the caller, when it is not required anymore... If the returned value is NULL, no options are available for this solver. Implemented in mcBisectSolver, mcSimplifySolver, mcExpandSolver, and mcPolySolver. |
|
Like math_DoCompleteSimplification but calls mcElementHelpers::math_Expand.
Referenced by mcExpandSolver::math_SolveLine(). |
|
Performs repeated simplification steps until the given system is not completely simplified. Returns the last step added to the given mcLineStepArray. Referenced by mcPolySolver::math_GetPolyCoeff(), mcSimplifySolver::math_SolveLine(), mcPolySolver::math_SolveLineFirstDegree(), and mcPolySolver::math_SolveLineSecondDegree(). |
|
Like math_DoSimplifyStep but calls mcElementHelpers::math_Expand.
|
|
Performs a simplification step on the given system and puts the new step in the given mcSystemStepArray.
If |
|
Returns the description of this solver.
Definition at line 156 of file Solver.h. References m_strDesc. |
|
Returns the description of the last error after a call to #Solve().
Definition at line 163 of file Solver.h. References m_strLastErr. |
|
Returns the name of this solver.
Definition at line 159 of file Solver.h. References m_strName. Referenced by mcSolverArray::math_Contains(). |
|
Returns the type of this solver.
Definition at line 166 of file Solver.h. References m_nType. |
|
Returns the n-th unknown symbol found in the given system.
|
|
Returns TRUE if this solver is ready to work. This function can be used to check if all the options/settings for this solver have been correctly set and the #Solve() function will correctly work (on a system where #WorksOn returns TRUE). Implemented in mcBisectSolver, mcSimplifySolver, mcExpandSolver, and mcPolySolver. Referenced by math_Solve(). |
|
Definition at line 251 of file Solver.cpp. References mcMATHLOG, mcTXT, and mcUNUSED. Referenced by math_Solve(). |
|
Definition at line 209 of file Solver.cpp. References mcMathOrSystem::data_AddSys(), mcMathAndSystem::data_GetLine(), mcSymbolArray::data_GetSymbol(), mcMathOrSystem::data_GetSys(), m_pUnkArr, m_strLastErr, mcElement::math_ContainsSymbol(), math_WorksOn(), mcMATHLOG, mcTXT, and mcTXTP. Referenced by math_Solve(). |
|
Sets to NULL the array containing the unknowns.
Definition at line 59 of file Solver.cpp. References m_pUnkArr, and mcSOLVER_MAXLINES. Referenced by mcSolver(). |
|
The most important function: it must apply the algorithm encapsulated in this class to the given math system.
Definition at line 267 of file Solver.cpp. References mcSymbolProperties::data_Check(), m_pUnkArr, m_strLastErr, math_isReady(), math_PostSolve(), math_PreSolve(), math_SolveLine(), math_WorksOn(), mcASSERT, mcMATHLOG, and mcTXT. |
|
Solves the given mcMathMng object for the given symbol, filling the given mcSystemStepArray with the intermediate resolution steps.
Implemented in mcBisectSolver, mcSimplifySolver, mcExpandSolver, and mcPolySolver. Referenced by math_Solve(). |
|
Definition at line 77 of file Solver.cpp. References math_SplitInTwoEquations(). |
|
Definition at line 84 of file Solver.cpp. References mcMathOrSystem::data_AddLineToLastAndSystem(), mcMathOrSystem::data_AddLineToNewAndSystem(), and mcLO_OR. |
|
Creates the solution.
Definition at line 65 of file Solver.cpp. Referenced by mcPolySolver::math_SolveLineSecondDegree(), and math_SplitInTwoEquations(). |
|
Works like math_WorksOn but this overloaded function also takes the symbol which will be used as unknown to solve for. This function is called after the more generic math_WorksOn function, when the unknown to be used to solve each specific line has been decided by math_PreSolve. |
|
Returns TRUE if this algorithm can be applied on the given math system solving it for one of the mcSymbol contained registered as unknowns.
Implemented in mcBisectSolver, mcSimplifySolver, mcExpandSolver, and mcPolySolver. Referenced by math_PreSolve(), and math_Solve(). |
|
The lenght value for the last step.
|
|
The unique identifier of this solver. This should be set on the derived-class constructor. Definition at line 70 of file Solver.h. Referenced by math_GetType(). |
|
The unknown respect to the system is being solved.
Definition at line 90 of file Solver.h. Referenced by math_PreSolve(), math_ResetUnkArray(), and math_Solve(). |
|
A short description of this solver. This should be set on the derived-class constructor. Definition at line 78 of file Solver.h. Referenced by math_GetDesc(). |
|
The description of the last error (if any).
Definition at line 81 of file Solver.h. Referenced by math_GetLastErr(), math_PreSolve(), and math_Solve(). |
|
The name of this solver. This should be set on the derived-class constructor. Definition at line 74 of file Solver.h. Referenced by math_GetName(). |
[ Top ] |