IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
KNGeometricAtom.cpp
Go to the documentation of this file.
1 
7 #include "stdafx.h"
8 #include "KNGeometricAtom.h"
9 #include "CKNGlobal.h"
10 
12 
14 {
15  unsigned int i;
16 
17  m_coordination.SetCoordination(0.0, 0.0, 0.0);
19  m_bPeriodic = false;
21 
22  for (i = 0; i < m_snNeighborNumber ; ++i)
23  {
26  m_vectCouplingType.push_back(NORMAL_CP);
29  }
30 
31 }
32 
34 {
35 }
36 
40 void CKNGeometricAtom::SetID(double fID)
41 {
42  m_fAtomID = fID;
43 }
44 
49 {
51 }
52 
56 void CKNGeometricAtom::SetCoordination(double* pfCoordination)
57 {
58  m_coordination.SetCoordination(pfCoordination);
59 }
60 
66 void CKNGeometricAtom::SetCoordination(double fXCoordination, double fYCoordination, double fZCoordination)
67 {
68  m_coordination.SetCoordination(fXCoordination, fYCoordination, fZCoordination);
69 }
70 
74 void CKNGeometricAtom::SetRatio(double fRatio[3])
75 {
76  m_coordination.SetRatio(fRatio);
77 }
78 
83 double CKNGeometricAtom::GetNeighborAtomID(unsigned int nIndex)
84 {
85  if (nIndex >= m_vectNeighbor.size())
86  return NULL;
87 
88  return m_vectNeighbor[nIndex];
89 }
90 
95 void CKNGeometricAtom::SetNeighbor(unsigned int nIndex, CKNGeometricAtom *pNeighbor)
96 {
97  if (nIndex >= m_vectNeighbor.size())
98  return;
99 
100  m_vectNeighbor[nIndex] = pNeighbor->GetID();
101 
102  if (pNeighbor->IsPeriodicAtom())
104 
105  m_vectNeighborCoordination[nIndex] = pNeighbor->GetCoordination();
107  m_vectNeighborMaterial[nIndex] = pNeighbor->GetMaterialNumber();
108 }
109 
113 void CKNGeometricAtom::ShiftID(double fShift)
114 {
115  if( - 1 != m_fAtomID )
116  m_fAtomID += fShift;
117 }
118 
124 {
125  if (nIndex < 0 || (unsigned int)nIndex >= m_vectCouplingType.size())
126  return false;
127 
128  return m_vectCouplingType[nIndex] == PERIODIC_CP ? true : false;
129 }
130 
136 {
137  if (nIndex < 0 || (unsigned int)nIndex >= m_vectNeighborCoordination.size())
138  return m_coordination;
139 
140  return m_vectNeighborCoordination[nIndex];
141 }
142 
148 {
149  if (nIndex < 0 || (unsigned int)nIndex >= m_vectNeighborPeriodicDirection.size())
150  return NONE;
151 
152  return m_vectNeighborPeriodicDirection[nIndex];
153 }
154 
160 {
161  if (nIndex < 0 || (unsigned int)nIndex >= m_vectNeighborPeriodicDirection.size())
162  return ATOM_NUM_BASE;
163 
164  return m_vectNeighborMaterial[nIndex];
165 }
166 
172 {
173  m_AtomType = type;
174  m_MaterialNumber = number;
175 }
MATERIAL_INDEX
Definition: CKNGlobal.h:106
void SetRatio(double fRatio[3])
Set ratio.
int GetNeighborPeriodicDirection(int nIndex)
Get neighbor coupling periodic direction if has coupling with periodic atom.
Class for coordination.
static unsigned int m_snNeighborNumber
Neighbor count.
double m_fAtomID
Atom ID.
void SetCoordination(CKNGeometricCoordination coordination)
Get atom coordination.
MATERIAL_INDEX GetMaterialMaterialNumber(unsigned int nIndex)
Get Neighbor material type.
void SetType(ATOM_TYPE type, MATERIAL_INDEX number)
Set atom information.
Class for Atom.
std::vector< MATERIAL_INDEX > m_vectNeighborMaterial
Array of neighbor material number.
ATOM_TYPE m_AtomType
Atom type.
void SetID(double fID)
Set atom ID.
CKNGeometricCoordination m_coordination
Atom coordination.
void ShiftID(double fShift)
Get atom ID.
Common definition for Solver.
std::vector< CKNGeometricCoordination > m_vectNeighborCoordination
Array of neighbor coordination.
CKNGeometricCoordination GetNeighborCoordination(int nIndex)
Get neighbor coordination.
std::vector< COUPLING_TYPE > m_vectCouplingType
Array of neighbor periodic direction.
std::vector< double > m_vectNeighbor
Array of neighbor atom.
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: CKNGlobal.h:53
bool IsPeriodicAtom()
Set atom is periodic.
int GetPeriodicDirection()
Adding periodic direction.
Class for Atom.
bool IsPeriodicCoupling(int nIndex)
Check is this periodic atom.
MATERIAL_INDEX GetMaterialNumber()
Get atom typpe.
bool m_bPeriodic
Periodic information of atom.
int m_periodicDirection
Periodic direction information.
std::vector< int > m_vectNeighborPeriodicDirection
void SetNeighbor(unsigned int nIndex, CKNGeometricAtom *pNeighbor)
Set neighbor information.
CKNGeometricCoordination GetCoordination()
Get Domain atom material type.
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination with double buffer.
void SetRatio(double fRatio[3])
Set ratio.
double GetNeighborAtomID(unsigned int nIndex)
Get neighbor atom count.
MATERIAL_INDEX m_MaterialNumber
Atom material number.