|
| 1 | +/* |
| 2 | + For more information, please see: http://software.sci.utah.edu |
| 3 | +
|
| 4 | + The MIT License |
| 5 | +
|
| 6 | + Copyright (c) 2009 Scientific Computing and Imaging Institute, |
| 7 | + University of Utah. |
| 8 | +
|
| 9 | + |
| 10 | + Permission is hereby granted, free of charge, to any person obtaining a |
| 11 | + copy of this software and associated documentation files (the "Software"), |
| 12 | + to deal in the Software without restriction, including without limitation |
| 13 | + the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 14 | + and/or sell copies of the Software, and to permit persons to whom the |
| 15 | + Software is furnished to do so, subject to the following conditions: |
| 16 | +
|
| 17 | + The above copyright notice and this permission notice shall be included |
| 18 | + in all copies or substantial portions of the Software. |
| 19 | +
|
| 20 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 21 | + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 23 | + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 24 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 25 | + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 26 | + DEALINGS IN THE SOFTWARE. |
| 27 | +*/ |
| 28 | + |
| 29 | +#ifndef CORE_ALGORITHMS_MATH_BooleanCompareALGO_H |
| 30 | +#define CORE_ALGORITHMS_MATH_BooleanCompareALGO_H |
| 31 | + |
| 32 | +#include <Core/Datatypes/Matrix.h> |
| 33 | +#include <Core/Datatypes/DenseMatrix.h> |
| 34 | +#include <Core/Datatypes/DenseColumnMatrix.h> |
| 35 | + |
| 36 | + |
| 37 | +#include <string> |
| 38 | +#include <sstream> |
| 39 | +#include <vector> |
| 40 | +#include <algorithm> |
| 41 | + |
| 42 | +#include <Core/Algorithms/Base/AlgorithmVariableNames.h> |
| 43 | +#include <Core/Algorithms/Base/AlgorithmBase.h> |
| 44 | +#include <Core/Algorithms/Math/share.h> |
| 45 | + |
| 46 | +namespace SCIRun { |
| 47 | +namespace Core { |
| 48 | +namespace Algorithms { |
| 49 | +namespace Math { |
| 50 | + |
| 51 | + ALGORITHM_PARAMETER_DECL(Value_Option_1); |
| 52 | + ALGORITHM_PARAMETER_DECL(Value_Option_2); |
| 53 | + ALGORITHM_PARAMETER_DECL(Then_Option); |
| 54 | + ALGORITHM_PARAMETER_DECL(Else_Option); |
| 55 | + ALGORITHM_PARAMETER_DECL(Comparison_Option); |
| 56 | + |
| 57 | +class SCISHARE BooleanCompareAlgo : public AlgorithmBase |
| 58 | +{ |
| 59 | + |
| 60 | + public: |
| 61 | + BooleanCompareAlgo(); |
| 62 | + AlgorithmOutput run(const AlgorithmInput& input) const; |
| 63 | + bool runImpl(Datatypes::DenseMatrixHandle matrixa, Datatypes::DenseMatrixHandle matrixb, std::string valoptA, std::string valoptB, std::string& cond_statement, int& cond_state) const; |
| 64 | + bool runImpl(Datatypes::DenseMatrixHandle matrixa, std::string valoptA, std::string& cond_statement, int& cond_state) const; |
| 65 | + bool return_check(int& cond_state, Datatypes::DenseMatrixHandle& cond_matrix, Datatypes::MatrixHandle& out_matrix, std::string then_result, std::string else_result, Datatypes::MatrixHandle matrixa, Datatypes::MatrixHandle matrixb, Datatypes::MatrixHandle possout) const; |
| 66 | + bool return_value(Datatypes::MatrixHandle& out_matrix, std::string result_statement, Datatypes::MatrixHandle first, Datatypes::MatrixHandle second, Datatypes::MatrixHandle possout) const; |
| 67 | + bool CompareMatrix(Datatypes::DenseMatrixHandle mata, Datatypes::DenseMatrixHandle matb, std::string cond_statement, int& cond_state) const; |
| 68 | + bool CompareMatrix(Datatypes::DenseMatrixHandle mata, int& cond_state) const; |
| 69 | + double ComputeNorm(Datatypes::DenseMatrixHandle mat) const; |
| 70 | +}; |
| 71 | + |
| 72 | + }}}}// end SCIRun namespace |
| 73 | +#endif |
0 commit comments