@@ -210,10 +210,10 @@ void MPMesh::computeMatricesAndSolve(){
210210}
211211
212212// Method 2 for coefficients
213- void MPMesh::subAssemblyCoeffs (int dim1 , int dim2 , double * m11, double * m12, double * m13, double * m14,
214- double * m22, double * m23, double * m24,
215- double * m33, double * m34,
216- double * m44){
213+ void MPMesh::subAssemblyCoeffs (int vtxPerElm , int nCellsPlus1 , double * m11, double * m12, double * m13, double * m14,
214+ double * m22, double * m23, double * m24,
215+ double * m33, double * m34,
216+ double * m44){
217217
218218 Kokkos::Timer timer;
219219 // Material Points Information
@@ -242,16 +242,16 @@ void MPMesh::subAssemblyCoeffs(int dim1, int dim2, double* m11, double* m12, dou
242242 if (p_mesh->getGeomType () == geom_spherical_surf)
243243 radius=p_mesh->getSphereRadius ();
244244
245- Kokkos::View<double **> m11_d (" m11" , dim1, dim2 );
246- Kokkos::View<double **> m12_d (" m12" , dim1, dim2 );
247- Kokkos::View<double **> m13_d (" m13" , dim1, dim2 );
248- Kokkos::View<double **> m14_d (" m14" , dim1, dim2 );
249- Kokkos::View<double **> m22_d (" m22" , dim1, dim2 );
250- Kokkos::View<double **> m23_d (" m23" , dim1, dim2 );
251- Kokkos::View<double **> m24_d (" m23" , dim1, dim2 );
252- Kokkos::View<double **> m33_d (" m33" , dim1, dim2 );
253- Kokkos::View<double **> m34_d (" m34" , dim1, dim2 );
254- Kokkos::View<double **> m44_d (" m34" , dim1, dim2 );
245+ Kokkos::View<double **> m11_d (" m11" , vtxPerElm, nCellsPlus1 );
246+ Kokkos::View<double **> m12_d (" m12" , vtxPerElm, nCellsPlus1 );
247+ Kokkos::View<double **> m13_d (" m13" , vtxPerElm, nCellsPlus1 );
248+ Kokkos::View<double **> m14_d (" m14" , vtxPerElm, nCellsPlus1 );
249+ Kokkos::View<double **> m22_d (" m22" , vtxPerElm, nCellsPlus1 );
250+ Kokkos::View<double **> m23_d (" m23" , vtxPerElm, nCellsPlus1 );
251+ Kokkos::View<double **> m24_d (" m23" , vtxPerElm, nCellsPlus1 );
252+ Kokkos::View<double **> m33_d (" m33" , vtxPerElm, nCellsPlus1 );
253+ Kokkos::View<double **> m34_d (" m34" , vtxPerElm, nCellsPlus1 );
254+ Kokkos::View<double **> m44_d (" m34" , vtxPerElm, nCellsPlus1 );
255255
256256 auto sub_assemble = PS_LAMBDA (const int & elm, const int & mp, const int & mask) {
257257 if (mask && (elm2Process (elm)==comm_rank)) { // if material point is 'active'/'enabled'
@@ -279,16 +279,16 @@ void MPMesh::subAssemblyCoeffs(int dim1, int dim2, double* m11, double* m12, dou
279279 pumipic::RecordTime (" VtxSubAssemblyComputeCoeff" , timer.seconds ());
280280
281281 Kokkos::Timer timer2;
282- kkDbl2dViewHostU m11_h (m11, dim1, dim2 );
283- kkDbl2dViewHostU m12_h (m12, dim1, dim2 );
284- kkDbl2dViewHostU m13_h (m13, dim1, dim2 );
285- kkDbl2dViewHostU m14_h (m14, dim1, dim2 );
286- kkDbl2dViewHostU m22_h (m22, dim1, dim2 );
287- kkDbl2dViewHostU m23_h (m23, dim1, dim2 );
288- kkDbl2dViewHostU m24_h (m24, dim1, dim2 );
289- kkDbl2dViewHostU m33_h (m33, dim1, dim2 );
290- kkDbl2dViewHostU m34_h (m34, dim1, dim2 );
291- kkDbl2dViewHostU m44_h (m44, dim1, dim2 );
282+ kkDbl2dViewHostU m11_h (m11, vtxPerElm, nCellsPlus1 );
283+ kkDbl2dViewHostU m12_h (m12, vtxPerElm, nCellsPlus1 );
284+ kkDbl2dViewHostU m13_h (m13, vtxPerElm, nCellsPlus1 );
285+ kkDbl2dViewHostU m14_h (m14, vtxPerElm, nCellsPlus1 );
286+ kkDbl2dViewHostU m22_h (m22, vtxPerElm, nCellsPlus1 );
287+ kkDbl2dViewHostU m23_h (m23, vtxPerElm, nCellsPlus1 );
288+ kkDbl2dViewHostU m24_h (m24, vtxPerElm, nCellsPlus1 );
289+ kkDbl2dViewHostU m33_h (m33, vtxPerElm, nCellsPlus1 );
290+ kkDbl2dViewHostU m34_h (m34, vtxPerElm, nCellsPlus1 );
291+ kkDbl2dViewHostU m44_h (m44, vtxPerElm, nCellsPlus1 );
292292
293293 Kokkos::deep_copy (m11_h, m11_d);
294294 Kokkos::deep_copy (m12_h, m12_d);
@@ -305,33 +305,33 @@ void MPMesh::subAssemblyCoeffs(int dim1, int dim2, double* m11, double* m12, dou
305305}
306306
307307// Method 2 for coefficients Solve matrix
308- void MPMesh::solveMatrixAndRegularize (int dim1 , double * m11, double * m12, double * m13, double * m14,
308+ void MPMesh::solveMatrixAndRegularize (int nVerticesPlus1 , double * m11, double * m12, double * m13, double * m14,
309309 double * m22, double * m23, double * m24,
310310 double * m33, double * m34,
311311 double * m44){
312312
313313 Kokkos::Timer timer;
314- kkViewHostU<const double *> m11_h (m11, dim1 );
315- kkViewHostU<const double *> m12_h (m12, dim1 );
316- kkViewHostU<const double *> m13_h (m13, dim1 );
317- kkViewHostU<const double *> m14_h (m14, dim1 );
318- kkViewHostU<const double *> m22_h (m22, dim1 );
319- kkViewHostU<const double *> m23_h (m23, dim1 );
320- kkViewHostU<const double *> m24_h (m24, dim1 );
321- kkViewHostU<const double *> m33_h (m33, dim1 );
322- kkViewHostU<const double *> m34_h (m34, dim1 );
323- kkViewHostU<const double *> m44_h (m44, dim1 );
314+ kkViewHostU<const double *> m11_h (m11, nVerticesPlus1 );
315+ kkViewHostU<const double *> m12_h (m12, nVerticesPlus1 );
316+ kkViewHostU<const double *> m13_h (m13, nVerticesPlus1 );
317+ kkViewHostU<const double *> m14_h (m14, nVerticesPlus1 );
318+ kkViewHostU<const double *> m22_h (m22, nVerticesPlus1 );
319+ kkViewHostU<const double *> m23_h (m23, nVerticesPlus1 );
320+ kkViewHostU<const double *> m24_h (m24, nVerticesPlus1 );
321+ kkViewHostU<const double *> m33_h (m33, nVerticesPlus1 );
322+ kkViewHostU<const double *> m34_h (m34, nVerticesPlus1 );
323+ kkViewHostU<const double *> m44_h (m44, nVerticesPlus1 );
324324
325- Kokkos::View<double *> m11_d (" m11" , dim1 );
326- Kokkos::View<double *> m12_d (" m12" , dim1 );
327- Kokkos::View<double *> m13_d (" m13" , dim1 );
328- Kokkos::View<double *> m14_d (" m14" , dim1 );
329- Kokkos::View<double *> m22_d (" m22" , dim1 );
330- Kokkos::View<double *> m23_d (" m23" , dim1 );
331- Kokkos::View<double *> m24_d (" m24" , dim1 );
332- Kokkos::View<double *> m33_d (" m33" , dim1 );
333- Kokkos::View<double *> m34_d (" m34" , dim1 );
334- Kokkos::View<double *> m44_d (" m44" , dim1 );
325+ Kokkos::View<double *> m11_d (" m11" , nVerticesPlus1 );
326+ Kokkos::View<double *> m12_d (" m12" , nVerticesPlus1 );
327+ Kokkos::View<double *> m13_d (" m13" , nVerticesPlus1 );
328+ Kokkos::View<double *> m14_d (" m14" , nVerticesPlus1 );
329+ Kokkos::View<double *> m22_d (" m22" , nVerticesPlus1 );
330+ Kokkos::View<double *> m23_d (" m23" , nVerticesPlus1 );
331+ Kokkos::View<double *> m24_d (" m24" , nVerticesPlus1 );
332+ Kokkos::View<double *> m33_d (" m33" , nVerticesPlus1 );
333+ Kokkos::View<double *> m34_d (" m34" , nVerticesPlus1 );
334+ Kokkos::View<double *> m44_d (" m44" , nVerticesPlus1 );
335335
336336 Kokkos::deep_copy (m11_d, m11_h);
337337 Kokkos::deep_copy (m12_d, m12_h);
@@ -347,9 +347,9 @@ void MPMesh::solveMatrixAndRegularize(int dim1, double* m11, double* m12, double
347347
348348 Kokkos::Timer timer2;
349349 auto dual_triangle_area=p_mesh->getMeshField <MeshF_DualTriangleArea>();
350- Kokkos::View<double *[vec4d_nEntries]> VtxCoeffs (" VtxCoeffs" , dim1 );
350+ Kokkos::View<double *[vec4d_nEntries]> VtxCoeffs (" VtxCoeffs" , nVerticesPlus1 );
351351 double radius=p_mesh->getSphereRadius ();
352- Kokkos::parallel_for (" fill" , dim1 , KOKKOS_LAMBDA (const int vtx){
352+ Kokkos::parallel_for (" fill" , nVerticesPlus1 , KOKKOS_LAMBDA (const int vtx){
353353 Vec4d v0 = {m11_d (vtx), m12_d (vtx), m13_d (vtx), m14_d (vtx)};
354354 Vec4d v1 = {m12_d (vtx), m22_d (vtx), m23_d (vtx), m24_d (vtx)};
355355 Vec4d v2 = {m13_d (vtx), m23_d (vtx), m33_d (vtx), m34_d (vtx)};
@@ -378,7 +378,7 @@ void MPMesh::solveMatrixAndRegularize(int dim1, double* m11, double* m12, double
378378
379379// Method2
380380template <MeshFieldIndex meshFieldIndex>
381- void MPMesh::subAssemblyVtx1 (int size1 , int size2 , int comp, double * array) {
381+ void MPMesh::subAssemblyVtx1 (int vtxPerElm , int nCellsPlus1 , int comp, double * array) {
382382 Kokkos::Timer timer;
383383
384384 auto VtxCoeffs=this ->precomputedVtxCoeffs ;
@@ -402,7 +402,7 @@ void MPMesh::subAssemblyVtx1(int size1, int size2, int comp, double* array) {
402402
403403 double radius=p_mesh->getSphereRadius ();
404404
405- Kokkos::View<double **> array_d (" reconstructedIceArea" , size1, size2 );
405+ Kokkos::View<double **> array_d (" reconstructedIceArea" , vtxPerElm, nCellsPlus1 );
406406 auto sub_assemble = PS_LAMBDA (const int & elm, const int & mp, const int & mask) {
407407 if (mask && (elm2Process (elm)==comm_rank)) {
408408 int nVtxE = elm2VtxConn (elm,0 ); // number of vertices bounding the element
@@ -426,7 +426,7 @@ void MPMesh::subAssemblyVtx1(int size1, int size2, int comp, double* array) {
426426 pumipic::RecordTime (" polyMPOsubAssemblyFieldCompute" , timer.seconds ());
427427
428428 Kokkos::Timer timer2;
429- kkDbl2dViewHostU arrayHost (array, size1, size2 );
429+ kkDbl2dViewHostU arrayHost (array, vtxPerElm, nCellsPlus1 );
430430 Kokkos::deep_copy (arrayHost, array_d);
431431 pumipic::RecordTime (" PolyMPOsubAssemblyFieldGet" , timer2.seconds ());
432432}
0 commit comments