/* void ** Convert_Line_World_To_View(FeaturePtr world_line, Viewport *vp, ** FeaturePtr res) ** Converts a line from world into view. Used by the placement routines. */ void Convert_Line_World_To_View(FeaturePtr world_line, Viewport *vp, FeaturePtr res) { Vector temp_v; /* Convert the direction.*/ MVMul(vp->world_to_view.matrix, world_line->f_vector, res->f_vector); /* Convert the point.*/ MVMul(vp->world_to_view.matrix, world_line->f_point, temp_v); VAdd(vp->world_to_view.displacement, temp_v, res->f_point); }
/* void ** Convert_Plane_World_To_View(FeaturePtr world_plane, Viewport *vp, ** FeaturePtr res) ** Converts a plane from world into view. Used by the placement routines. */ void Convert_Plane_World_To_View(FeaturePtr world_plane, Viewport *vp,FeaturePtr res) { Matrix transp; Vector temp_v; /* Convert the point.*/ MVMul(vp->world_to_view.matrix, world_plane->f_point, temp_v); VAdd(vp->world_to_view.displacement, temp_v, res->f_point); /* Convert the normal. */ MTrans(vp->view_to_world.matrix, transp); MVMul(transp, world_plane->f_vector, res->f_vector); }
void GenSiteCoords () { VecR t; int j, n; DO_MOL { for (j = 0; j < sitesMol; j ++) { MVMul (t, mol[n].rMatT.u, mSite[j].r); VAdd (site[sitesMol * n + j].r, mol[n].r, t); } } }
/* ** void ** Convert_World_To_View(Vector *world_verts, Vertex *view_verts, ** short num_verts, Viewport *vp) ** Takes an array of vertices from world to view. ** world_verts: the vertices in world. ** view_verts: the vertices in view. ** num_verts: the number of vertices to convert. ** vp: the viewport to use for the transformation. */ void Convert_World_To_View(Vector *world_verts, Vertex *view_verts, short num_verts, Viewport *vp) { int i; Vector temp_v; for ( i = 0 ; i < num_verts; i++ ) { MVMul(vp->world_to_view.matrix, world_verts[i], temp_v); VAdd(vp->world_to_view.displacement, temp_v, view_verts[i].view); } }
void GenSiteCoords () { RMat rMat; VecR t; int j, n; DO_MOL { BuildRotMatrix (&rMat, &mol[n].q, 1); for (j = 0; j < sitesMol; j ++) { MVMul (t, rMat.u, mSite[j].r); VAdd (site[sitesMol * n + j].r, mol[n].r, t); } } }
int _tmain(int argc, _TCHAR* argv[]) { int nRank, nTotalRank; double fStartTime, fEndTime; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &nTotalRank); MPI_Comm_rank(MPI_COMM_WORLD, &nRank); initVariables(); LoadBalance(nTotalRank, nRank, atoi(argv[1])); if( 0 == nRank ) fStartTime = MPI_Wtime(); if(LoadMatrixNVectorData(g_nSize, atoi(argv[2]))) { if( 0 == nRank ) { fEndTime = MPI_Wtime(); printf("File Read Time: %lf\n", fEndTime - fStartTime); } MVMul(); if( 0 == nRank ) { fStartTime = MPI_Wtime(); printf("MVMul Time: %lf\n", fStartTime - fEndTime); } SaveResult(nRank, nTotalRank); if( 0 == nRank ) { fEndTime = MPI_Wtime(); printf("File Writing Time: %lf\n", fEndTime - fStartTime); } } else { if( 0 == nRank ) printf("Can't allocate memeory!\n"); } FinalVariables(); MPI_Finalize(); return 0; }
void ComputeTorqs () { RMat rMat; VecR dr, t, torqS; int j, n; DO_MOL { VZero (mol[n].ra); VZero (torqS); for (j = 0; j < sitesMol; j ++) { VVAdd (mol[n].ra, site[n * sitesMol + j].f); VSub (dr, site[n * sitesMol + j].r, mol[n].r); VCross (t, dr, site[n * sitesMol + j].f); VVAdd (torqS, t); } BuildRotMatrix (&rMat, &mol[n].q, 0); MVMul (mol[n].torq, rMat.u, torqS); } }
void ComputeTorqs () { VecR dr, t, torqS, waB; int j, n; DO_MOL { VZero (mol[n].ra); VZero (torqS); for (j = 0; j < sitesMol; j ++) { VVAdd (mol[n].ra, site[n * sitesMol + j].f); VSub (dr, site[n * sitesMol + j].r, mol[n].r); VCross (t, dr, site[n * sitesMol + j].f); VVAdd (torqS, t); } MVMulT (waB, mol[n].rMatT.u, torqS); VDiv (waB, waB, mInert); MVMul (mol[n].wa, mol[n].rMatT.u, waB); } }