| 1 |
rtomiyasu |
3 |
/* |
| 2 |
|
|
* The MIT License |
| 3 |
|
|
|
| 4 |
|
|
Conograph (powder auto-indexing program) |
| 5 |
|
|
|
| 6 |
|
|
Copyright (c) <2012> <Ryoko Oishi-Tomiyasu, KEK> |
| 7 |
|
|
|
| 8 |
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 |
|
|
of this software and associated documentation files (the "Software"), to deal |
| 10 |
|
|
in the Software without restriction, including without limitation the rights |
| 11 |
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 |
|
|
copies of the Software, and to permit persons to whom the Software is |
| 13 |
|
|
furnished to do so, subject to the following conditions: |
| 14 |
|
|
|
| 15 |
|
|
The above copyright notice and this permission notice shall be included in |
| 16 |
|
|
all copies or substantial portions of the Software. |
| 17 |
|
|
|
| 18 |
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 |
|
|
THE SOFTWARE. |
| 25 |
|
|
* |
| 26 |
|
|
*/ |
| 27 |
|
|
#include <set> |
| 28 |
|
|
#include "Node3.hh" |
| 29 |
|
|
#include "../utility_data_structure/VCData.hh" |
| 30 |
|
|
#include "../utility_data_structure/index_set.hh" |
| 31 |
|
|
#include "../utility_func/transform_sym_matrix.hh" |
| 32 |
|
|
|
| 33 |
|
|
Node3::Node3() |
| 34 |
|
|
{ |
| 35 |
|
|
m_detS = 0.0; |
| 36 |
|
|
m_detS_var = 0.0; |
| 37 |
|
|
} |
| 38 |
|
|
|
| 39 |
|
|
Node3::Node3(const Node3& rhs) |
| 40 |
|
|
{ |
| 41 |
|
|
for(Int4 i=0; i<NUM_K; i++) m_K[i] = rhs.m_K[i]; |
| 42 |
|
|
for(Int4 i=0; i<NUM_SUM_K; i++) m_sum_K[i] = rhs.m_sum_K[i]; |
| 43 |
|
|
m_detS = rhs.m_detS; |
| 44 |
|
|
m_detS_var = rhs.m_detS_var; |
| 45 |
|
|
} |
| 46 |
|
|
|
| 47 |
|
|
Node3::~Node3() |
| 48 |
|
|
{ |
| 49 |
|
|
} |
| 50 |
|
|
|
| 51 |
|
|
Node3& Node3::operator=(const Node3& rhs) |
| 52 |
|
|
{ |
| 53 |
|
|
if(this != &rhs) |
| 54 |
|
|
{ |
| 55 |
|
|
for(Int4 i=0; i<NUM_K; i++) m_K[i] = rhs.m_K[i]; |
| 56 |
|
|
for(Int4 i=0; i<NUM_SUM_K; i++) m_sum_K[i] = rhs.m_sum_K[i]; |
| 57 |
|
|
m_detS = rhs.m_detS; |
| 58 |
|
|
m_detS_var = rhs.m_detS_var; |
| 59 |
|
|
} |
| 60 |
|
|
return *this; |
| 61 |
|
|
} |
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
bool Node3::setBud0(const Double& cv2, |
| 65 |
|
|
const VCData& K0, |
| 66 |
|
|
const VCData& K1, |
| 67 |
|
|
const VCData& K2, |
| 68 |
|
|
const VCData& K3, |
| 69 |
|
|
const VCData& K01, |
| 70 |
|
|
const VCData& K02, |
| 71 |
|
|
SymMat<VCData>& S) |
| 72 |
|
|
{ |
| 73 |
|
|
this->K(0) = K0; |
| 74 |
|
|
this->K(1) = K1; |
| 75 |
|
|
this->K(2) = K2; |
| 76 |
|
|
|
| 77 |
|
|
this->SumK(0, 1) = K01; |
| 78 |
|
|
this->SumK(0, 2) = K02; |
| 79 |
rtomiyasu |
33 |
// |l1+l2|^2 = |l0|^2 + |l1|^2 + |l2|^2 + |l0+l1+l2|^2 - |l0+l1|^2 - |l0+l2|^2 |
| 80 |
rtomiyasu |
3 |
this->SumK(1, 2) = K0 + K1 + K2 + K3 - K01 - K02; |
| 81 |
|
|
|
| 82 |
|
|
S = calculateS3(*this); |
| 83 |
|
|
m_detS = Determinant3( chToDouble(S) ); |
| 84 |
|
|
if( m_detS <= 0.0 ) return false; |
| 85 |
|
|
return true; |
| 86 |
|
|
} |