-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #4201 Added MDWDDescription class
- Loading branch information
Showing
8 changed files
with
127 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#ifndef H_MDEVENT_WS_DESCRIPTION | ||
#define H_MDEVENT_WS_DESCRIPTION | ||
|
||
#include "MantidMDEvents/MDEvent.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace MDEvents | ||
{ | ||
/** Lighteweith class wrapping together all parameters, related to MDEventoWorkspace used mainly to reduce number of parameters trasferred between | ||
* an algorithm, creating MD workspace and UI. | ||
* | ||
* Introduced to decrease code bloat in methods and algorithms, which use MDEvents write interface and run-time defined number of dimensions | ||
@date 2011-28-12 | ||
Copyright © 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
/// helper class describes the properties of target MD workspace, which should be obtained as the result of conversion algorithm. | ||
struct DLLExport MDWSDescription | ||
{ | ||
public: | ||
/// constructor | ||
MDWSDescription():n_dims(0),emode(-1){}; | ||
/// mainly test constructor; | ||
MDWSDescription(size_t nDimesnions); | ||
/// the variable which describes the number of the dimensions, in the target workspace. | ||
/// Calculated from number of input properties and the operations, performed on input workspace; | ||
size_t n_dims; | ||
/// conversion mode (see its description below) | ||
int emode; | ||
/// minimal and maximal values for the workspace dimensions: | ||
std::vector<double> dim_min,dim_max; | ||
/// the names for the target workspace dimensions and properties of input MD workspace | ||
std::vector<std::string> dim_names; | ||
/// the units of target workspace dimensions and properties of input MD workspace dimensions | ||
std::vector<std::string> dim_units; | ||
/// the matrix to transform momentums of the workspace into notional target coordinate system | ||
std::vector<double> rotMatrix; // should it be the Quat? | ||
/// helper function checks if min values are less them max values and are consistent between each other | ||
void checkMinMaxNdimConsistent(Mantid::Kernel::Logger& log)const; | ||
|
||
}; | ||
|
||
|
||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "MantidMDEvents/MDWSDescription.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace MDEvents | ||
{ | ||
|
||
/** function verifies the consistency of the min and max dimsnsions values checking if all necessary | ||
* values vere defined and min values are smaller then mav values */ | ||
void | ||
MDWSDescription::checkMinMaxNdimConsistent(Mantid::Kernel::Logger& g_log)const | ||
{ | ||
if(this->dim_min.size()!=this->dim_max.size()||this->dim_min.size()!=this->n_dims) | ||
{ | ||
g_log.error()<<" number of specified min dimension values: "<<dim_min.size()<<", number of max values: "<<dim_max.size()<< | ||
" and total number of target dimensions: "<<n_dims<<" are not consistent\n"; | ||
throw(std::invalid_argument("wrong number of dimension limits")); | ||
} | ||
|
||
for(size_t i=0; i<this->dim_min.size();i++) | ||
{ | ||
if(this->dim_max[i]<=this->dim_min[i]) | ||
{ | ||
g_log.error()<<" min value "<<dim_min[i]<<" not less then max value"<<dim_max[i]<<" in direction: "<<i<<std::endl; | ||
throw(std::invalid_argument("min limit not smaller then max limit")); | ||
} | ||
} | ||
} | ||
|
||
MDWSDescription::MDWSDescription(size_t nDimesnions): | ||
n_dims(nDimesnions), | ||
emode(-1), | ||
dim_names(nDimesnions,"mdn"), | ||
dim_units(nDimesnions,"Momentum"), | ||
dim_min(nDimesnions,-1), | ||
dim_max(nDimesnions,1) | ||
{} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters