75 for (i = 0; i < nSize; ++i)
88 for (i = 0; i < nSize; ++i)
111 for (i = 0; i < nSize; ++i)
119 if (cx < lpParam->fOrigin[j+1][0] || cx > (lpParam->
fOrigin[j+1][0] + lpParam->
fShapeLength[j+1][0]))
122 switch (lpParam->
nShape[j + 1])
125 if (cy < lpParam->fOrigin[j + 1][1] || cy >(lpParam->
fOrigin[j + 1][1] + lpParam->
fShapeLength[j + 1][1]))
128 if (cz < lpParam->fOrigin[j + 1][2] || cz >(lpParam->
fOrigin[j + 1][2] + lpParam->
fShapeLength[j + 1][2]))
157 unsigned int count = 0;
159 for (i = 0; i < nSize; ++i)
186 if ((pow((cy - (fLength[
_Y] / 2)), 2) / pow(fLength[
_Y] / 2, 2)) +
187 pow((cz - (fLength[
_Z] / 2)), 2) / pow(fLength[
_Z] / 2, 2) > 1)
223 double cx[3], cy[3], cz[3];
224 int cxCount = 1, cyCount = 1, czCount = 1;
231 if (cx[0] > 0 || (cx[0] == 0 &&
false == bFrontFace))
232 cx[cxCount++] = cx[0] - 1;
235 cy[cyCount++] = cy[0] - 1;
238 cz[czCount++] = cz[0] - 1;
240 if (cx[0] < fAssignedCount[
_X] - 1 || (cx[0] == fAssignedCount[
_X] - 1 &&
false == bBackEnd))
241 cx[cxCount++] = cx[0] + 1;
243 if (cy[0] < fAssignedCount[
_Y] - 1)
244 cy[cyCount++] = cy[0] + 1;
246 if (cz[0] < fAssignedCount[
_Z] - 1)
247 cz[czCount++] = cz[0] + 1;
249 for (x = 0; x < cxCount; ++x)
251 for (y = 0; y < cyCount; ++y)
253 for (z = 0; z < czCount; ++z)
255 if (0 == x && 0 == y && 0 == z)
285 for( i = 0 ;i < nSize ; ++ i )
308 return fXAssignedIndex * floor(fAssignedCount[1]) * floor(fAssignedCount[2]) + fYAssignedIndex * floor(fAssignedCount[2]) + fZAssignedIndex;
317 for (i = 0; i < nSize; ++i)
328 for (i = 0; i < nSize; ++i)
340 for (i = 0; i < nSize; ++i)
350 double i, j, nSecondIndex, nSize;
355 std::vector<CKNGeometricCoordination> *pNeighborRelation = NULL;
356 bool bFindAll =
false;
359 for (i = 0; i < nSize; ++i)
376 for (j = 0; j < nSize - 1; ++j)
380 if (nSecondIndex == i)
391 if (-1 != nMatchingIndex)
394 nCheckFill |= (int)(pow((
double)2, (
int)nMatchingIndex));
410 for (j = 0; j < nNeighborUnitcellSize; ++j)
415 #ifndef DISABLE_MPI_ROUTINE
420 NeighborCell =
m_vectUnitCellInPrev->at((
int)fNeighborID + (
int)(floor(pfAssignCount[
_Y]) * floor(pfAssignCount[
_Z])));
428 NeighborCell =
m_vectUnitCellInNext->at((
int)fNeighborID - (
int)(floor(pfAssignCount[
_X]) * floor(pfAssignCount[
_Y]) * floor(pfAssignCount[
_Z])));
433 #endif //DISABLE_MPI_ROUTINE
448 for (i = 0; i < nSize; ++i)
456 for (j = 0; j < nNeighborSize; ++j)
460 pSurfaceList->push_back(pAtom);
480 nSize = pNeighborRelation->size();
481 for (i = 0; i < nSize; ++i)
488 coordination1.
SetOffset(pNeighborRelation->at(i));
490 if (coordination2 == coordination1)
511 for (i = 0; i < nSize; ++i)
520 if (-1 != nMatchingIndex)
523 nCheckFill |= (int)(pow((
double)2, (
int)nMatchingIndex));
526 if (15 == nCheckFill)
541 for( i = 0; i < nSize;++i)
562 for( i = 0; i < nSize;++i)
566 atom.
SetID(pBuffer[nPos++]);
567 if( 0 == pBuffer[nPos++])
574 double x = pBuffer[nPos++];
575 double y = pBuffer[nPos++];
576 double z = pBuffer[nPos++];
594 for (i = 0; i < nSize; ++i)
620 for (i = 0; i < nSize; ++i)
631 for (i = 0; i < nSize; ++i)
double m_fUnitCellID
Unit cell ID.
double m_fAssignedIndex[3]
Assign index.
CKNGeometricCoordination m_coordination
Coordination of unit cell.
Factory class for create CKNGeometricAtom instance.
int IsMachedNeighborRule(CKNGeometricAtom *pCompare1, CKNGeometricAtom *pCompare2, std::vector< CKNGeometricCoordination > *pNeighborRelation, int &nCheckFill)
Checking neighbor with rule.
unsigned int GetNeighborCount()
Class for Geometric unit cell.
std::vector< double > m_vectNeighborCellID
Neighbor unit cell list.
void CheckingNeighborCandiate(double fAssignedCount[3], bool bFrontFace, bool bBackEnd)
Find neigbhor candidate for neighbor in atom. Maxium 26 unitcell index can be assigned.
std::vector< CKNGeometricUnitCell > * m_vectUnitCellInNext
Back side unit cell list in shape.
void SetPeriodicDirection(int periodicDirection)
int m_periodicDirection
Periodic direction information.
void SetCoordination(CKNGeometricCoordination coordination)
Get atom coordination.
double * GetCoordinationAll()
void ShiftAtomID(double fShift)
Get neighbor unit cell ID.
void CopyInnerAtomIndex(CKNGeometricUnitCell srcUnitCell)
Copy atom id from source. This functino for periodic atom setting.
void ShiftID(double fShift)
Get unit cell ID.
void FinalSubElement()
Finalizing SubElement.
void SetType(ATOM_TYPE type, MATERIAL_INDEX number)
Set atom information.
int nShape[NMAXDOMAIN]
Geometric Shape.
Class for Geometric unit cell.
void ArrangeAtom(CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set atoms information(coordination, type) in unit cell.
void SetOffset(CKNGeometricCoordination coord)
To offset coordination.
std::vector< CKNGeometricUnitCell > * m_vectUnitCellInPrev
Front side unit cell list in shape.
static int GetAtomCountInUnitcell()
#define GENERAL_TOLERANCE
General tolerance definition.
CKNGeometricAtom * GetSubElementByID(double fID)
Return atom in unitcell by atom ID.
static MATERIAL_INDEX GetMaterialNumber(char *pszMaterialName, CKNGeometricAtom::ATOM_TYPE type)
Get total atom counts in unit cell.
static double m_fLength[3]
Unit cell length.
void SetID(double fID)
Set atom ID.
void SetAssignIndex(double fXAssignIndex, double fYAssignIndex, double fZAssignIndex)
Get Assign index.
bool m_bPeriodicElement
Periodic element flag.
Common definition for Solver.
void SetPeriodic(bool bPeriodic, int periodicDirection)
To mark unit cell is periodic condition.
Structure for save input command file parsing result.
double fShapeLength[NMAXDOMAIN][3]
Shap length x, y, z, direction.
std::vector< CKNGeometricAtom > m_vectIntenalAtom
Atom in unit cell.
bool FindingNeighborInUnitcell(CKNGeometricUnitCell *pUnitcell, CKNGeometricAtom *pCompare1, CKNGeometricAtom::ATOM_TYPE type1, std::vector< CKNGeometricCoordination > *pNeighborRelation, int &nCheckFill)
Finding neighbor in same unit cell.
void Serialize(double *pBuffer)
Convert unit cell data to double buffer.
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
void AddPeridoicDirection(CKNGeometricAtom::PERIODIC_DIRECTION periodicDirection)
Adding periodic direction.
void SetPeriodicDirection(int periodicDirection)
Set periodic direction.
static std::vector< CKNGeometricCoordination > m_vectNeighborRelation2To1
Neighbor relationship from cation to anion.
unsigned int NumberingSubElement(CKNGeometricCoordination ShapeCoordination, double fLength[3], int nShapeType, char *pszDomainMatName)
Assign atom ID to sub element(atoms in unit cell)
char szDomainMat[NMAXDOMAIN][1024]
Material type.
int nSubDomainNumber
Numbers of Subdomain, except main domain.
CKNGeometricAtom * GetSubElementAt(double fIndex)
Get atom count in unit cell.
static void SetLength(double fLength[3], double fOriginLength[3])
Set unit cell length.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
void SetSubDomainMaterial(CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set atoms information(coordination, type) in unit cell.
static double CalculatingIndex(double fXAssignedIndex, double fYAssignedIndex, double fZAssignedIndex, double fAssignedCount[3])
Calulating unit cell index.
static std::vector< CKNGeometricAtom > m_vectAtomList_1
Get total Neighbor count in unit cell.
static double m_SubElementID
Maxium atom ID in shape.
void SetPeriodic(bool bPeriodic)
static std::vector< CKNGeometricCoordination > m_vectNeighborRelation1To2
Neighbor relationship from anion to cation.
void SetNeighbor(unsigned int nIndex, CKNGeometricAtom *pNeighbor)
Set neighbor information.
CKNGeometricCoordination GetCoordination()
Get Domain atom material type.
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination of unit cell.
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination with double buffer.
void SetDomainMaterial(MATERIAL_INDEX number)
Set atom material information.
static std::vector< CKNGeometricAtom > m_vectAtomList_2
Atom array for cation.
static int m_nFullFillIndex
Get SubElement ID. It means new atom id.
double GetID()
Set unit cell ID.
void Deserialize(double *pBuffer)
Convert double buffer to unit cell data.
void SetUnitcellList(std::vector< CKNGeometricUnitCell > *pVect, std::vector< CKNGeometricUnitCell > *pVectPrev, std::vector< CKNGeometricUnitCell > *pVectNext)
Set unit cell list of shape to each unit cell.
void BuildNeighborInformation(double *pfAssignCount, std::vector< CKNGeometricAtom * > *pSurfaceList)
Build neighbor information to each atom.
std::vector< CKNGeometricUnitCell > * m_vectUnitCellInShape
Unit cell list in shape.
double GetNeighborAtomID(unsigned int nIndex)
Get neighbor atom count.
double fOrigin[NMAXDOMAIN][3]
Coordinator original coordinate.