Skip to content
Merged
Show file tree
Hide file tree
Changes from 197 commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
d1e4e7f
migration test
Angelyr Feb 9, 2024
41eef0a
copied old code
Angelyr Feb 9, 2024
8a79fa4
owning proc
Angelyr Feb 9, 2024
8234bc2
initialize material points
Angelyr Feb 9, 2024
4bad5b8
migration test working
Angelyr Feb 13, 2024
007c14e
moved out divide procs
Angelyr Feb 14, 2024
851f99c
divide in wedges
Angelyr Feb 14, 2024
66e00fd
rename procWedges
Angelyr Feb 14, 2024
561ee39
use mpi_allreduce
Angelyr Feb 21, 2024
3dbf75a
do while
Angelyr Feb 21, 2024
59d7c6e
update comment
Angelyr Feb 21, 2024
23ff539
migration timer
Angelyr Feb 21, 2024
b7af748
only run test if mpi
Angelyr Feb 21, 2024
b810f54
change MPF_Constv_Mdl_Param to MeshF_Invalid
RPIFisherman Apr 15, 2024
87ad5de
skeleton of reconstruction APIs
RPIFisherman Apr 15, 2024
7111077
setReconstructSlice
Angelyr Apr 16, 2024
f2fbda8
assembly
Angelyr Apr 17, 2024
ad5cb3e
more reconstruct slice types
Angelyr Apr 19, 2024
70fe07c
API changes
RPIFisherman Apr 24, 2024
325a42a
constexpr mpSliceToMeshField
Angelyr Apr 24, 2024
2714909
mpSliceToMeshFieldSize
Angelyr Apr 24, 2024
c2e24d4
switch statement
Angelyr Apr 24, 2024
c2e500f
fixed spacing
Angelyr Apr 24, 2024
eb926e2
renaming
RPIFisherman Apr 25, 2024
abdd251
Merge branch 'ac/reconstruction-code' into yg/fortranMPFieldsRecons
RPIFisherman Apr 25, 2024
45a8dae
moved assembly to MPMesh
Angelyr Apr 25, 2024
75db26c
moved reconstruct slice
Angelyr Apr 26, 2024
59f0319
move reconstruct down
Angelyr Apr 26, 2024
68273a7
merge from yg/fortranMPFieldsRecons
Angelyr Apr 26, 2024
219de7d
template type conversion
Angelyr Apr 26, 2024
6de1bba
reconsOption
Angelyr Apr 26, 2024
7db86c9
reconstruct error
Angelyr Apr 30, 2024
33e532e
rename pmpo_assembly.hpp
Angelyr Apr 30, 2024
2ebd503
seperate template index size
Angelyr Apr 30, 2024
8ce9676
fixed comments
Angelyr May 1, 2024
c12d831
slice to type
Angelyr May 1, 2024
514bf6a
combine size and type
Angelyr May 1, 2024
931e28b
fixed sizes
Angelyr May 1, 2024
206690c
MPTypeHelper
Angelyr May 3, 2024
ce6647b
compile time getSize
Angelyr May 3, 2024
ff6a3f7
removed type alias
Angelyr May 3, 2024
32a5d76
using typedef
Angelyr May 6, 2024
3537cea
variable renaming, notation fix
RPIFisherman May 6, 2024
d923fe0
using util types
Angelyr May 6, 2024
be1a761
reuse vec2d
Angelyr May 6, 2024
b5415ec
first scratch
RPIFisherman May 6, 2024
9766115
remove mesh types
Angelyr May 13, 2024
db9cf81
add two options for recons
RPIFisherman May 14, 2024
244f269
Merge branch 'ac/reconstruction-code' into yg/fortranMPFieldsRecons
RPIFisherman May 14, 2024
16f7ad4
add reconstruct API
RPIFisherman May 14, 2024
c7978ab
test Recons
RPIFisherman May 15, 2024
f0eab00
removed extra types
Angelyr May 15, 2024
39db742
reuse doubleview
Angelyr May 15, 2024
16f92dc
rename mpSliceToNumEntries
Angelyr May 15, 2024
74fad5d
Merge branch 'ac/reconstruction-code' of https://github.com/SCOREC/po…
RPIFisherman May 16, 2024
2982786
remove setReconstructionOption, recons APIs name changes
RPIFisherman May 20, 2024
04b7e29
swap mesh field and material point field
Angelyr May 21, 2024
ab0c665
add vtx/elm Mass mesh fields
RPIFisherman May 22, 2024
9ac1622
set/get APIs for vtx/elm Mass mesh fields
RPIFisherman May 22, 2024
2ffbeb3
Merge branch 'ac/reconstruction-code' into yg/fortranMPFieldsRecons
RPIFisherman May 22, 2024
4b3d1e9
order change, put vtxMass and elmMass together
RPIFisherman May 22, 2024
030faf4
mesh ENt TYpe
Angelyr May 22, 2024
3fafa3e
doubleScrl
Angelyr May 22, 2024
e8e9dfe
assembly order
Angelyr May 22, 2024
8e0f305
test for set/get vtx/elm Mass APIs
RPIFisherman May 23, 2024
5c655ad
Merge branch 'ac/reconstruction-code' into yg/fortranMPFieldsRecons
RPIFisherman May 23, 2024
7c72481
change order of MeshFieldIndex enums
RPIFisherman May 29, 2024
01ed8fe
split into two functions
Angelyr Jun 2, 2024
9efb88a
Merge branch 'yg/fortranMPFieldsRecons' of https://github.com/SCOREC/…
Angelyr Jun 2, 2024
b5a5703
fixed getmeshenttype
Angelyr Jun 2, 2024
008ddfb
added elm or vtx to mesh fields
Angelyr Jun 2, 2024
c8f1dbf
assembly refactor
Angelyr Jun 2, 2024
1dd7786
elm based assembly
Angelyr Jun 2, 2024
7cd695f
fortran get mesh type
Angelyr Jun 2, 2024
dfbf897
removed basis and mass weight
Angelyr Jun 3, 2024
9409ca4
rename mesh field type
Angelyr Jun 3, 2024
0e96269
moved mesh field type fortran
Angelyr Jun 3, 2024
2151c98
moved mpMass mpVel
Angelyr Jun 3, 2024
abc89fa
test vtx mass
Angelyr Jun 4, 2024
231b10a
error msg
Angelyr Jun 4, 2024
0e441ba
average num added
Angelyr Jun 5, 2024
5cd803e
rename num components
Angelyr Jun 5, 2024
dda4286
1D num components
Angelyr Jun 5, 2024
a773fa1
test elm mass
Angelyr Jun 5, 2024
3466013
average order 0
Angelyr Jun 11, 2024
5fccd19
removed for testing
Angelyr Jun 11, 2024
e8a2183
calculate basis
Angelyr Jun 11, 2024
a5e8930
multiply weights
Angelyr Jun 12, 2024
3deba98
removed recon option
Angelyr Jun 12, 2024
5374e4a
assembly refactor
Angelyr Jun 12, 2024
af46ed9
fixed set elm mass
Angelyr Jun 12, 2024
66f59c9
calculate basis
Angelyr Jun 13, 2024
ae13ea5
remove unused
Angelyr Jun 16, 2024
840ef8c
fix recon test bug
Angelyr Jun 17, 2024
98993cc
tests passing
Angelyr Jun 17, 2024
f42c245
fixed unit test
Angelyr Jun 25, 2024
25703b8
test elm push reconstruction
Angelyr Jun 25, 2024
aed7204
small reconstruct test fixes
Angelyr Jun 26, 2024
e130a9e
moved tolerance
Angelyr Jun 26, 2024
4f05ba8
moved calculate surface displacement
Angelyr Jul 2, 2024
367ebfb
moved calculate displacement
Angelyr Jul 3, 2024
be80a24
mps per edge
Angelyr Jul 8, 2024
26e4694
remove inbound
Angelyr Jul 8, 2024
8d655ad
find new mp position
Angelyr Jul 8, 2024
3d05114
rename mps scale factor per vtx
Angelyr Jul 8, 2024
ea04fbd
count num mps starting at 0
Angelyr Jul 8, 2024
8bed835
fixed num mps
Angelyr Jul 9, 2024
cedb717
fixed num mps
Angelyr Jul 9, 2024
de65a0a
removed unused
Angelyr Jul 9, 2024
b474971
fixed radius
Angelyr Jul 9, 2024
327911f
num mps count
Angelyr Jul 9, 2024
a547a03
numMPs count
Angelyr Jul 9, 2024
73eaac7
fixed mpPosition error
Angelyr Jul 9, 2024
75063fa
calcSurfDispIncr
Angelyr Jul 9, 2024
44eea2f
bring back xc
Angelyr Jul 9, 2024
b49dc9a
record time
Angelyr Jul 9, 2024
b4fb99b
summrize time
Angelyr Jul 9, 2024
9bd66a3
more timers
Angelyr Jul 9, 2024
420daf8
print scale factor num mps
Angelyr Jul 9, 2024
c8e96dd
skip reconstruct if size == 0
Angelyr Jul 10, 2024
0751d18
read input from command line
Angelyr Jul 10, 2024
ca8c816
fixed perlmutter error
Angelyr Jul 10, 2024
c708130
fixed elm push test
Angelyr Jul 11, 2024
edf67c3
Merge branch 'ac/reconstruction-code' of https://github.com/SCOREC/po…
Angelyr Jul 11, 2024
553695f
fixed vtx test
Angelyr Jul 11, 2024
50a4002
rename tolerance
Angelyr Jul 11, 2024
21954c3
timing verbosity
Angelyr Jul 11, 2024
64dd06e
more timers
Angelyr Jul 11, 2024
6657923
moved advection test
Angelyr Jul 12, 2024
39a3e72
rename advection test
Angelyr Jul 12, 2024
ab9da1e
combined reconstruction and advection test
Angelyr Jul 12, 2024
77be2eb
num push
Angelyr Jul 12, 2024
e46a89a
more timers
Angelyr Jul 12, 2024
6a44409
modify test
Angelyr Jul 12, 2024
9f1d5fc
api test
Angelyr Jul 15, 2024
3026017
function timers
Angelyr Jul 15, 2024
0ec75be
added new files
Angelyr Jul 16, 2024
0232f3c
calcsurfDispIncr
Angelyr Jul 16, 2024
6f11255
advection passing
Angelyr Jul 16, 2024
5d062e1
pumipic timing
Angelyr Jul 16, 2024
6ab0ae8
set Proc Wedges
Angelyr Jul 16, 2024
bb00e55
fixed mpi test perlmutter
Angelyr Jul 17, 2024
6bf8003
set owning proc
Angelyr Jul 17, 2024
4448cef
fixed owning proc
Angelyr Jul 17, 2024
9733e99
timers
Angelyr Jul 17, 2024
9676003
fixed error
Angelyr Jul 18, 2024
6d99d0c
cap normalize
Angelyr Jul 24, 2024
82ba6f4
clip normalized
Angelyr Jul 24, 2024
7e6b736
remake fill mesh field
Angelyr Jul 29, 2024
cac413e
Debug statement, run for just 1 step
dhyan1272 Jul 29, 2024
f46e91e
Debug statemensts in reconstruction
dhyan1272 Aug 2, 2024
e2c2764
elem of MP as before
dhyan1272 Aug 2, 2024
06f3f91
Num_elems_with_mps_before and after tracking
dhyan1272 Aug 2, 2024
60e3f1e
Bug of distance, element to element connectivity, and indexing -1
dhyan1272 Aug 9, 2024
cc2ab6e
Remove log file created erroneously
dhyan1272 Aug 9, 2024
6885608
Used offset in adajcency calculated before
dhyan1272 Aug 12, 2024
aa47551
Reverting to use of -1 instead of offset for setting elment to elemen…
dhyan1272 Aug 12, 2024
da467ec
E2E connetion not set a pplication level, -1 at tracking for now
dhyan1272 Aug 12, 2024
50b1893
fixed migration bug
Angelyr Aug 14, 2024
8b639ea
removed comments whitespace
Angelyr Aug 14, 2024
58d0bbe
removed whitespace
Angelyr Aug 14, 2024
39ad114
remove unsued warnings
Angelyr Aug 14, 2024
e37645a
Merge branch 'dn/reconstruction-code' into ac/reconstruction-code
Angelyr Aug 14, 2024
81bde51
removed debug code
Angelyr Aug 16, 2024
3d8bdd6
Merge yg/elem_centre to ac/reconstrcuction
dhyan1272 Aug 29, 2024
1fe77ea
Not calculating old detla averaged centroid
dhyan1272 Aug 30, 2024
7aeb386
Changes requested in PR
dhyan1272 Sep 10, 2024
262a4aa
Minor formats
dhyan1272 Sep 10, 2024
e75fdb4
PR changes 2
dhyan1272 Sep 17, 2024
29b283c
Merge pull request #66 from SCOREC/dn/rec_elm_center
onkarsahni Sep 18, 2024
5f6d963
Option to reverse lat lon increment
dhyan1272 Sep 18, 2024
91b3b9a
Check difference initial and final pos
dhyan1272 Sep 18, 2024
c5792f0
Fixed spherical interp bug, quantiatative push ctest
dhyan1272 Sep 19, 2024
c26a055
Assert statement added
dhyan1272 Sep 20, 2024
f64c2ed
Linear Reconstruction
dhyan1272 Oct 2, 2024
6292949
Linear Construction working, cleaner
dhyan1272 Oct 15, 2024
017ff34
enable c
Angelyr Oct 17, 2024
8f85fd6
Merge branch 'cws/pumipicDps' into ac/reconstruction-code
Angelyr Oct 17, 2024
d858ac5
Merge remote-tracking branch 'origin/ac/simple-migration' into ac/rec…
Angelyr Oct 30, 2024
e04f3af
divide advection tests
Angelyr Oct 30, 2024
6fb94f2
mpi fortran migration test
Angelyr Oct 30, 2024
f0913e4
typo
Angelyr Oct 30, 2024
3dddd47
Cleaned, Linear Reconstruction with regularization
dhyan1272 Nov 4, 2024
333d2de
Some more cleaning
dhyan1272 Nov 4, 2024
644bf31
Added rotated cordinates, added linear reconstruction test
dhyan1272 Nov 7, 2024
726f00f
Merged with ac/reconstruction
dhyan1272 Nov 7, 2024
d90e369
Some more cleaning
dhyan1272 Nov 7, 2024
1da2366
Stricter tolerance
dhyan1272 Nov 7, 2024
e26dc5b
Linear Reconstruction test commented
dhyan1272 Nov 7, 2024
8333764
PR changes 1
dhyan1272 Nov 11, 2024
c7dfb27
Linear rec with MPs as Cell Centres
dhyan1272 Nov 11, 2024
8de3f3f
PR Changes 2
dhyan1272 Nov 11, 2024
dae686b
PR Change 3
dhyan1272 Nov 12, 2024
c52003e
Merge pull request #67 from SCOREC/dn/rotated_linear
onkarsahni Nov 12, 2024
e638a1f
renaming
Angelyr Nov 20, 2024
9b7bcd2
set mpi communicator
Angelyr Nov 20, 2024
d86ea08
assert spherical
Angelyr Nov 20, 2024
9e94aab
linear typo
Angelyr Nov 27, 2024
ebd5ecb
unimplemented code fix
Angelyr Dec 9, 2024
92ecb65
rename variabel
Angelyr Dec 9, 2024
113ddfe
change version
Angelyr Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ jobs:
-DCMAKE_BUILD_TYPE="Debug"
-DKokkos_DIR=${{ runner.temp }}/build-kokkos/install/lib64/cmake/Kokkos
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/build-pumi-pic/install
-DIS_TESTING=on
-DCMAKE_CXX_COMPILER=mpicxx
-DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/build-polyMPO/install

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(HEADERS
pmpo_wachspressBasis.hpp
pmpo_MPMesh.hpp
pmpo_utils.hpp
pmpo_assembly.hpp
pmpo_MPMesh_assembly.hpp
pmpo_c.h
pmpo_createTestMPMesh.hpp
)
Expand Down
135 changes: 105 additions & 30 deletions src/pmpo_MPMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,44 @@ namespace polyMPO{

void printVTP_mesh(MPMesh& mpMesh, int printVTPIndex=-1);

void MPMesh::calcBasis() {
assert(p_mesh->getGeomType() == geom_spherical_surf);
auto MPsPosition = p_MPs->getPositions();
auto mp_basis_field = p_MPs->getData<MPF_Basis_Vals>(); // we can implement MPs->getBasisVals() like MPs->getPositions()
auto elm2VtxConn = p_mesh->getElm2VtxConn();
auto vtxCoords = p_mesh->getMeshField<MeshF_VtxCoords>();
double radius = p_mesh->getSphereRadius();

auto calcbasis = PS_LAMBDA(const int& elm, const int& mp, const int& mask) {
if(mask) { //if material point is 'active'/'enabled'
Vec3d position3d(MPsPosition(mp,0),MPsPosition(mp,1),MPsPosition(mp,2));
// formating
Vec3d v3d[maxVtxsPerElm+1];
int numVtx = elm2VtxConn(elm,0);
for(int i = 1; i<=numVtx; i++){
v3d[i-1][0] = vtxCoords(elm2VtxConn(elm,i)-1,0);
v3d[i-1][1] = vtxCoords(elm2VtxConn(elm,i)-1,1);
v3d[i-1][2] = vtxCoords(elm2VtxConn(elm,i)-1,2);
}
v3d[numVtx][0] = vtxCoords(elm2VtxConn(elm,1)-1,0);
v3d[numVtx][1] = vtxCoords(elm2VtxConn(elm,1)-1,1);
v3d[numVtx][2] = vtxCoords(elm2VtxConn(elm,1)-1,2);

double basisByArea3d[maxVtxsPerElm] = {0.0};
initArray(basisByArea3d,maxVtxsPerElm,0.0);

// calc basis
getBasisByAreaGblFormSpherical2(position3d, numVtx, v3d, radius, basisByArea3d);

// fill step
for(int i=0; i<= numVtx; i++){
mp_basis_field(mp,i) = basisByArea3d[i];
}
}
};
p_MPs->parallel_for(calcbasis, "calcbasis");
}

void MPMesh::CVTTrackingEdgeCenterBased(Vec2dView dx){
int numElms = p_mesh->getNumElements();

Expand Down Expand Up @@ -74,36 +112,26 @@ void MPMesh::CVTTrackingEdgeCenterBased(Vec2dView dx){


void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
Kokkos::Timer timer;
int numVtxs = p_mesh->getNumVertices();
int numElms = p_mesh->getNumElements();
auto numMPs = p_MPs->getCount();

const auto vtxCoords = p_mesh->getMeshField<polyMPO::MeshF_VtxCoords>();
const auto elmCenter = p_mesh->getMeshField<polyMPO::MeshF_ElmCenterXYZ>();

auto elm2VtxConn = p_mesh->getElm2VtxConn();
auto elm2ElmConn = p_mesh->getElm2ElmConn();

auto mpPositions = p_MPs->getData<MPF_Cur_Pos_XYZ>();
auto mpTgtPos = p_MPs->getData<MPF_Tgt_Pos_XYZ>();
auto MPs2Elm = p_MPs->getData<MPF_Tgt_Elm_ID>();;
auto MPs2Elm = p_MPs->getData<MPF_Tgt_Elm_ID>();
auto MPs2Proc = p_MPs->getData<MPF_Tgt_Proc_ID>();
auto elm2Process = p_mesh->getElm2Process();

if(printVTPIndex>=0) {
printVTP_mesh(printVTPIndex);
}

Vec3dView elmCenter("elementCenter",numElms);
Kokkos::parallel_for("calcElementCenter", numElms, KOKKOS_LAMBDA(const int elm){
int numVtx = elm2VtxConn(elm,0);
double sum_x = 0.0, sum_y = 0.0, sum_z = 0.0;
for(int i=1; i<= numVtx; i++){
sum_x += vtxCoords(elm2VtxConn(elm,i)-1,0);
sum_y += vtxCoords(elm2VtxConn(elm,i)-1,1);
sum_z += vtxCoords(elm2VtxConn(elm,i)-1,2);
}
elmCenter(elm)[0] = sum_x/numVtx;
elmCenter(elm)[1] = sum_y/numVtx;
elmCenter(elm)[2] = sum_z/numVtx;
});

Vec3dView history("positionHistory",numMPs);
Vec3dView resultLeft("positionResult",numMPs);
Vec3dView resultRight("positionResult",numMPs);
Expand All @@ -116,22 +144,32 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
Vec3d MPnew(mpTgtPos(mp,0),mpTgtPos(mp,1),mpTgtPos(mp,2));
Vec3d dx = MPnew-MP;
while(true){
int numVtx = elm2VtxConn(iElm,0);
Vec3d delta = MPnew - elmCenter(iElm);
double minDistSq = delta[0]*delta[0] + delta[1]*delta[1];
int numConnElms = elm2ElmConn(iElm,0);

Vec3d center(elmCenter(iElm, 0), elmCenter(iElm, 1), elmCenter(iElm, 2));
Vec3d delta = MPnew - center;

double minDistSq = delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2];
int closestElm = -1;
//go through all the connected elm, calc distance
for(int i=1; i<=numVtx; i++){
int elmID = elm2ElmConn(iElm,i);
delta = MPnew - elmCenter(elmID);
double neighborDistSq = delta[0]*delta[0] + delta[1]*delta[1];
for(int i=1; i<=numConnElms; i++){
int elmID = elm2ElmConn(iElm,i)-1;

//New delta
Vec3d center(elmCenter(elmID, 0), elmCenter(elmID, 1), elmCenter(elmID, 2));
delta = MPnew - center;

double neighborDistSq = delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2];
if(neighborDistSq < minDistSq){
closestElm = elmID;
minDistSq = neighborDistSq;
}
}

if(closestElm<0){
MPs2Elm(mp) = iElm;
if (elm2Process.size() > 0)
MPs2Proc(mp) = elm2Process(iElm);
break;
}else{
iElm = closestElm;
Expand Down Expand Up @@ -193,6 +231,7 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
fprintf(pFile," </DataArray>\n </Lines>\n </Piece>\n </PolyData>\n</VTKFile>\n");
fclose(pFile);
}
pumipic::RecordTime("PolyMPO_CVTTrackingElmCenterBased", timer.seconds());
}

void MPMesh::T2LTracking(Vec2dView dx){
Expand Down Expand Up @@ -258,17 +297,53 @@ void MPMesh::T2LTracking(Vec2dView dx){
p_MPs->parallel_for(T2LCalc,"T2lTrackingCalc");
}

void MPMesh::reconstructSlices() {
if (reconstructSlice.size() == 0) return;
Kokkos::Timer timer;
calcBasis();
for (auto const& [index, reconstruct] : reconstructSlice) {
if (reconstruct) reconstruct();
}
reconstructSlice.clear();
pumipic::RecordTime("PolyMPO_Reconstruct", timer.seconds());
}

bool getAnyIsMigrating(MaterialPoints* p_MPs, bool isMigrating) {
Kokkos::Timer timer;
MPI_Comm comm = p_MPs->getMPIComm();
int comm_rank;
MPI_Comm_rank(comm, &comm_rank);
int comm_size;
MPI_Comm_size(comm, &comm_size);

bool anyIsMigrating = false;
MPI_Allreduce(&isMigrating, &anyIsMigrating, 1, MPI_C_BOOL, MPI_LOR, comm);
pumipic::RecordTime("PolyMPO_getAnyIsMigrating", timer.seconds());
return anyIsMigrating;
}

void MPMesh::push(){
Kokkos::Timer timer;
p_mesh->computeRotLatLonIncr();
sphericalInterpolation<MeshF_RotLatLonIncr, MPF_Rot_Lat_Lon_Incr>(*this);
sphericalInterpolation<MeshF_RotLatLonIncr>(*this);
p_MPs->updateRotLatLonAndXYZ2Tgt(p_mesh->getSphereRadius()); // set Tgt_XYZ
auto elm2Process = p_mesh->getElm2Process();

CVTTrackingElmCenterBased(); // move to Tgt_XYZ
bool anyIsMigrating = false;
do {
CVTTrackingElmCenterBased(); // move to Tgt_XYZ
p_MPs->updateMPSlice<MPF_Cur_Pos_XYZ, MPF_Tgt_Pos_XYZ>(); // Tgt_XYZ becomes Cur_XYZ
p_MPs->updateMPSlice<MPF_Cur_Pos_Rot_Lat_Lon, MPF_Tgt_Pos_Rot_Lat_Lon>(); // Tgt becomes Cur
if (elm2Process.size() > 0)
anyIsMigrating = getAnyIsMigrating(p_MPs, p_MPs->migrate());
else
p_MPs->rebuild(); //rebuild pumi-pic
p_MPs->updateMPElmID(); //update mpElm IDs slices
reconstructSlices();
}
while (anyIsMigrating);

p_MPs->updateMPSlice<MPF_Cur_Pos_XYZ, MPF_Tgt_Pos_XYZ>(); // Tgt_XYZ becomes Cur_XYZ
p_MPs->updateMPSlice<MPF_Cur_Pos_Rot_Lat_Lon, MPF_Tgt_Pos_Rot_Lat_Lon>(); // Tgt becomes Cur
p_MPs->rebuild(); //rebuild pumi-pic
p_MPs->updateMPElmID(); //update mpElm IDs slices
pumipic::RecordTime("PolyMPO_push", timer.seconds());
}

void MPMesh::printVTP_mesh(int printVTPIndex){
Expand All @@ -282,7 +357,7 @@ void MPMesh::printVTP_mesh(int printVTPIndex){
FILE * pFile = fopen(fileOutput,"w");
free(fileOutput);

DoubleVec3dView::HostMirror h_vtxCoords = Kokkos::create_mirror_view(vtxCoords);
auto h_vtxCoords = Kokkos::create_mirror_view(vtxCoords);
IntVtx2ElmView::HostMirror h_elm2VtxConn = Kokkos::create_mirror_view(elm2VtxConn);
const int nCells = p_mesh->getNumElements();
const int nVertices = p_mesh->getNumVertices();
Expand Down
27 changes: 27 additions & 0 deletions src/pmpo_MPMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@

namespace polyMPO{

template <MeshFieldIndex> const MaterialPointSlice meshFieldIndexToMPSlice;
template <> const MaterialPointSlice meshFieldIndexToMPSlice < MeshF_Vel > = MPF_Vel;
template <> const MaterialPointSlice meshFieldIndexToMPSlice < MeshF_VtxMass > = MPF_Mass;
template <> const MaterialPointSlice meshFieldIndexToMPSlice < MeshF_ElmMass > = MPF_Mass;
template <> const MaterialPointSlice meshFieldIndexToMPSlice < MeshF_RotLatLonIncr > = MPF_Rot_Lat_Lon_Incr;

#define maxMPsPerElm 8

class MPMesh{
public:
Mesh* p_mesh;
MaterialPoints* p_MPs;

std::map<MeshFieldIndex, std::function<void()>> reconstructSlice = std::map<MeshFieldIndex, std::function<void()>>();

MPMesh(Mesh* inMesh, MaterialPoints* inMPs):
p_mesh(inMesh), p_MPs(inMPs) {
Expand All @@ -26,6 +34,25 @@ class MPMesh{
void CVTTrackingElmCenterBased(const int printVTPIndex = -1);
void T2LTracking(Vec2dView dx);
void push();
void calcBasis();

DoubleView assemblyV0();
template <MaterialPointSlice index>
DoubleView wtScaAssembly();
template <MaterialPointSlice index>
Vec2dView wtVec2Assembly();
template <MeshFieldIndex meshFieldIndex>
void assembly(int order, MeshFieldType type, bool basisWeightFlag, bool massWeightFlag);
template <MeshFieldIndex meshFieldIndex>
void assemblyVtx0();
template <MeshFieldIndex meshFieldIndex>
void assemblyElm0();
template <MeshFieldIndex meshFieldIndex>
void assemblyVtx1();

template<MeshFieldIndex meshFieldIndex>
void setReconstructSlice(int order, MeshFieldType type);
void reconstructSlices();

void printVTP_mesh(int printVTPIndex);
};
Expand Down
Loading