initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / utilities / preProcessing / molConfig / origin.H
blob24bc994d34fe8eaee58b7c77a71613d1bf8bc004
1 // Please refer to notes
3 // 1. Determine the unit cell dimensions: xU, yU and zU
5 const scalar xU = gap.x();
6 const scalar yU = gap.y();
7 const scalar zU = gap.z();
9 // 2. Determine the anchorPoint co-ordinates: xA, yA  and zA
11 const scalar xA = anchorPoint.x();
12 const scalar yA = anchorPoint.y();
13 const scalar zA = anchorPoint.z();
15 // 3. Determine the vector rAB from global co-ordinate system:
17 const vector rAB((xMid - xA), (yMid - yA), (zMid - zA));
19 // 4. Transform vector rAS into lattice co-ordinate system:
21 const vector rASTransf = transform(latticeToGlobal.T(), rAB);
23 // Info << "The vector rAS = " << rAS << endl;
24 // Info << "The vector rAStransf = " << rAStransf << endl;
26 // 5. Calculate the integer values: ni, nj and nk
27 scalar nIscalar = rASTransf.x()/xU;
28 scalar nJscalar = rASTransf.y()/yU;
29 scalar nKscalar = rASTransf.z()/zU;
31 // Info << "The nI, nJ, nK values before are: " << nIscalar <<" "<< nJscalar <<" "<< nKscalar << endl;
33 label nI = label(nIscalar + 0.5*sign(nIscalar));
34 label nJ = label(nJscalar + 0.5*sign(nJscalar));
35 label nK = label(nKscalar + 0.5*sign(nKscalar));
37 // Info << "The nI, nJ, nK values after are: " << nI <<" "<< nJ <<" "<< nK << endl;
39 // 6. Calculate the corrected starting point, rAC (in the lattice co-ordinate system):
40 const vector rAC((nI*xU), (nJ*yU), (nK*zU));
42 // 7. Transform the corrected starting point in the global co-ordinate system, rC:
43 const vector rC = anchorPoint + transform(latticeToGlobal, rAC);
46 const vector& origin = rC;
48 // Pout << "The Corrected Starting Point: " << origin << endl;