mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
Compute Progress bar
- int& GetComputeCost() { return _computeCost; } + std::vector<SMESH_subMesh*>& SubMeshesToCompute() { return _smToCompute; }
This commit is contained in:
parent
f4ec60b8ca
commit
a311b5af11
@ -754,7 +754,6 @@ void SMESH_Algo::InitComputeError()
|
||||
_badInputElements.clear();
|
||||
|
||||
_computeCanceled = false;
|
||||
_computeCost = 1;
|
||||
_progressTic = 0;
|
||||
_progress = 0.;
|
||||
}
|
||||
@ -767,9 +766,14 @@ void SMESH_Algo::InitComputeError()
|
||||
|
||||
double SMESH_Algo::GetProgressByTic() const
|
||||
{
|
||||
int computeCost = 0;
|
||||
for ( size_t i = 0; i < _smToCompute.size(); ++i )
|
||||
computeCost += _smToCompute[i]->GetComputeCost();
|
||||
|
||||
const_cast<SMESH_Algo*>( this )->_progressTic++;
|
||||
|
||||
double x = 5 * _progressTic;
|
||||
x = ( x < _computeCost ) ? ( x / _computeCost ) : 1.;
|
||||
x = ( x < computeCost ) ? ( x / computeCost ) : 1.;
|
||||
return 0.9 * sin( x * M_PI / 2 );
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
|
||||
*/
|
||||
SMESH_ComputeErrorPtr GetComputeError() const;
|
||||
/*!
|
||||
* \brief initialize compute error before call of Compute()
|
||||
* \brief initialize compute error etc. before call of Compute()
|
||||
*/
|
||||
void InitComputeError();
|
||||
/*!
|
||||
@ -243,9 +243,9 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
|
||||
*/
|
||||
double GetProgressByTic() const;
|
||||
/*!
|
||||
* Return a storage of "compute cost" of shapes being Compute()d.
|
||||
* Return a vector of sub-meshes to Compute()
|
||||
*/
|
||||
int& GetComputeCost() { return _computeCost; }
|
||||
std::vector<SMESH_subMesh*>& SubMeshesToCompute() { return _smToCompute; }
|
||||
|
||||
public:
|
||||
// ==================================================================
|
||||
@ -421,9 +421,11 @@ protected:
|
||||
std::list<const SMDS_MeshElement*> _badInputElements; //!< to explain COMPERR_BAD_INPUT_MESH
|
||||
|
||||
volatile bool _computeCanceled; //!< is set to True while computing to stop it
|
||||
int _computeCost; //!< "compute cost" of shapes being Compute()d
|
||||
int _progressTic; //!< counter of calls from SMESH_Mesh::GetComputeProgress()
|
||||
double _progress; //!< progress of Compute() [0.,1.]
|
||||
|
||||
double _progress; /* progress of Compute() [0.,1.],
|
||||
to be set by an algo really tracking the progress */
|
||||
int _progressTic; // counter of calls from SMESH_Mesh::GetComputeProgress()
|
||||
std::vector<SMESH_subMesh*> _smToCompute; // sub-meshes to Compute()
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user