#include <ParFUM_SA.h>
Public Member Functions | |
ParFUMShadowArray (int s, int i) | |
constructor | |
ParFUMShadowArray (CkMigrateMessage *m) | |
constructor for migration | |
~ParFUMShadowArray () | |
destructor | |
void | pup (PUP::er &p) |
Pup to transfer this object's data. | |
void | ckJustMigrated (void) |
This function is overloaded, it is called on this object just after migration. | |
int | getNumChunks () |
Get number of chunks. | |
int | getIdx () |
Get the index of this chunk. | |
FEM_Mesh * | getfmMesh () |
Get the pointer to the mesh object. | |
void | setFemMesh (FEMMeshMsg *m) |
Initialize the mesh pointer for this chunk. | |
void | setRunningTCharm () |
void | sort (int *chkList, int chkListSize) |
Sort this list of numbers in increasing order. | |
int | lockRegion (int numElements, adaptAdj *elements, RegionID *regionID, double prio) |
This method locks all the nodes belonging to the specified elements. | |
void | unlockRegion (RegionID regionID) |
void | unpendRegion (RegionID regionID) |
void | collectLocalNodes (int numElements, adaptAdj *elements, CkVec< int > &localNodes) |
Find all the local nodes in the connectivity of the list of elements and store it in the vector localNodes. | |
bool | lockLocalNodes (LockRegion *region) |
bool | lockSharedIdxls (LockRegion *region) |
Lock the sharedidxls specified in the region. | |
void | lockRegionForRemote (RegionID regionID, int *sharedIdxls, int numSharedIdxls, adaptAdj *elements, int numElements) |
Process a request from another chunk to lock these idxls and the nodes belonging to these elements. | |
void | lockReply (int remoteChunk, RegionID regionID, int success, int tag, int otherSuccess) |
Collect the replies from all the remote chunks that were requested to lock regions of the mesh. | |
void | unlockRegion (LockRegion *region) |
Free up all the local nodes, idxl and elements on remote chunk locked by this node. | |
void | unlockLocalNodes (LockRegion *region) |
void | unlockSharedIdxls (LockRegion *region) |
Unlock all the shared idxl on this chunk. | |
void | unlockForRemote (RegionID regionID) |
Unlock the local nodes and sharedIdxls locked for the remote region specified by regionID. | |
void | unpendForRemote (RegionID regionID) |
void | unlockReply (int remoteChunk, RegionID regionID) |
Collect the replies to unlock requests from all the chunks that are involved in this region. | |
void | freeRegion (LockRegion *region) |
FEM_Comm * | FindIdxlSide (int idxlType) |
Translates the sharedChk and the idxlType to the idxl side. | |
int | IdxlAddPrimary (int localId, int sharedChk, int idxlType) |
Add this 'localId' to this idxl list and return the shared entry index. | |
bool | IdxlAddSecondary (int localId, int sharedChk, int sharedIdx, int idxlType) |
Add this 'sharedIdx' to this idxl list. | |
int | IdxlRemovePrimary (int localId, int sharedChk, int idxlType) |
Remove this 'localId' from this idxl list and return the shared entry index. | |
bool | IdxlRemoveSecondary (int sharedChk, int sharedIdx, int idxlType) |
Remove the entry in this idxl list at index 'sharedIdx'. | |
int | IdxlLookUpPrimary (int localId, int sharedChk, int idxlType) |
Lookup this 'localId' in this idxl list and return the shared entry index. | |
int | IdxlLookUpSecondary (int sharedChk, int sharedIdx, int idxlType) |
Return the localIdx at this 'sharedIdx' on this idxl list. | |
adaptAdjMsg * | remote_bulk_edge_bisect_2D (adaptAdj &nbrElem, adaptAdj &splitElem, int new_idxl, int n1_idxl, int n2_idxl, int partitionID) |
These are entry methods for bulk adaptivity. | |
void | remote_adaptAdj_replace (adaptAdj &elem, adaptAdj &oldElem, adaptAdj &newElem) |
void | remote_edgeAdj_replace (int remotePartID, adaptAdj &adj, adaptAdj &elem, adaptAdj &splitElem, int n1_idxl, int n2_idxl) |
void | remote_edgeAdj_add (int remotePartID, adaptAdj &adj, adaptAdj &splitElem, int n1_idxl, int n2_idxl) |
void | recv_split_3D (int pos, int tableID, adaptAdj &elem, adaptAdj &splitElem) |
void | handle_split_3D (int remotePartID, int pos, int tableID, adaptAdj &elem, RegionID lockRegionID, int n1_idxl, int n2_idxl, int n5_idxl) |
void | recv_splits (int tableID, int expectedSplits) |
longestMsg * | isLongest (int elem, int elemType, double len) |
void | update_asterisk_3D (int remotePartID, int i, adaptAdj &elem, int numElemPairs, adaptAdj *elemPairs, RegionID lockRegionID, int n1_idxl, int n2_idxl, int n5_idxl) |
Data Fields | |
BulkAdapt * | bulkAdapt |
RegionID | holdingLock |
RegionID | pendingLock |
Private Attributes | |
int | numChunks |
Total number of chunks. | |
int | idx |
Index of this chunk (the chunk this is attached to). | |
TCharm * | tc |
The Tcharm pointer to set it even outside the thread.. | |
CProxy_TCharm | tproxy |
The proxy for the current Tcharm object. | |
FEM_Mesh * | fmMesh |
cross-pointer to the fem mesh on this chunk | |
CkHashtableT < CkHashtableAdaptorT < RegionID >, LockRegion * > | regionTable |
Deprecated: used to lock this chunk. | |
int | regionCount |
Definition at line 68 of file ParFUM_SA.h.
constructor
Definition at line 55 of file ParFUM_SA.C.
References fmMesh, holdingLock, idx, RegionID::localID, numChunks, pendingLock, and regionCount.
ParFUMShadowArray::ParFUMShadowArray | ( | CkMigrateMessage * | m | ) |
constructor for migration
Definition at line 64 of file ParFUM_SA.C.
References fmMesh, RegionID::localID, pendingLock, regionCount, and tc.
ParFUMShadowArray::~ParFUMShadowArray | ( | ) |
void ParFUMShadowArray::pup | ( | PUP::er & | p | ) |
void ParFUMShadowArray::ckJustMigrated | ( | void | ) |
This function is overloaded, it is called on this object just after migration.
Definition at line 82 of file ParFUM_SA.C.
References c, ArrayElement::ckJustMigrated(), FEM_globalID, fmMesh, FEM_chunk::getMesh(), idx, FEM_Mesh::setParfumSA(), TCharm::sud, tc, and tproxy.
int ParFUMShadowArray::getNumChunks | ( | ) | [inline] |
int ParFUMShadowArray::getIdx | ( | ) | [inline] |
FEM_Mesh* ParFUMShadowArray::getfmMesh | ( | ) | [inline] |
void ParFUMShadowArray::setFemMesh | ( | FEMMeshMsg * | m | ) |
Initialize the mesh pointer for this chunk.
Definition at line 91 of file ParFUM_SA.C.
References bulkAdapt, fmMesh, TCharm::getProxy(), idx, FEMMeshMsg::m, FEMMeshMsg::meshid, FEM_Mesh::setParfumSA(), FEMMeshMsg::t, tc, and tproxy.
void ParFUMShadowArray::setRunningTCharm | ( | ) | [inline] |
Definition at line 112 of file ParFUM_SA.h.
References tc.
Referenced by BulkAdapt::add_element(), and BulkAdapt::add_node().
Sort this list of numbers in increasing order.
Helper function that uses bubble sort to sort the indices in the given array in increasing order These lists are usually small, so bubble sort is good enough.
Definition at line 104 of file ParFUM_SA.C.
int ParFUMShadowArray::lockRegion | ( | int | numElements, | |
adaptAdj * | elements, | |||
RegionID * | regionID, | |||
double | prio | |||
) |
This method locks all the nodes belonging to the specified elements.
Elements might be on remote chunk. Corresponding idxls between other chunks must also be locked
Definition at line 144 of file ParFUM_SA.C.
References RegionID::chunkID, collectLocalNodes(), CthSelf(), CthSuspend(), fmMesh, CkHashtableT< KEY, OBJ >::get(), IDXL_Side::getRec(), CkVec< T >::getVec(), hasGreaterPrio(), holdingLock, idx, CkVec< T >::length(), list, RegionID::localID, LockRegion::localNodes, LockRegion::myID, FEM_Mesh::node, LockRegion::numReplies, adaptAdj::partID, pendingLock, RegionID::prio, CkVec< T >::push_back(), CkHashtableTslow< KEY, OBJ >::put(), regionCount, regionTable, LockRegion::remoteElements, CkHashtableTslow< KEY, OBJ >::remove(), FEM_Node::shared, LockRegion::sharedIdxls, CkVec< T >::size(), LockRegion::success, LockRegion::tid, uniquify(), unlockRegion(), and unpendRegion().
Referenced by BulkAdapt::edge_bisect_2D(), and BulkAdapt::lock_3D_region().
void ParFUMShadowArray::unlockRegion | ( | RegionID | regionID | ) |
Definition at line 622 of file ParFUM_SA.C.
References RegionID::chunkID, CthSuspend(), CkHashtableT< KEY, OBJ >::get(), holdingLock, idx, CkVec< T >::length(), RegionID::localID, pendingLock, RegionID::prio, regionTable, CkHashtableTslow< KEY, OBJ >::remove(), and LockRegion::sharedIdxls.
Referenced by BulkAdapt::edge_bisect_2D(), lockRegion(), lockReply(), and BulkAdapt::unlock_3D_region().
void ParFUMShadowArray::unpendRegion | ( | RegionID | regionID | ) |
Definition at line 585 of file ParFUM_SA.C.
References RegionID::chunkID, CthSuspend(), CkHashtableT< KEY, OBJ >::get(), holdingLock, idx, CkVec< T >::length(), RegionID::localID, LockRegion::myID, LockRegion::numReplies, pendingLock, regionTable, CkHashtableTslow< KEY, OBJ >::remove(), and LockRegion::sharedIdxls.
Referenced by lockRegion(), and BulkAdapt::unpend_3D_region().
void ParFUMShadowArray::collectLocalNodes | ( | int | numElements, | |
adaptAdj * | elements, | |||
CkVec< int > & | localNodes | |||
) |
Find all the local nodes in the connectivity of the list of elements and store it in the vector localNodes.
Definition at line 342 of file ParFUM_SA.C.
References conn, elem, adaptAdj::elemType, fmMesh, FEM_Mesh::getElem(), idx, FEM_Adapt_Algs::numNodes, CkVec< T >::push_back(), and uniquify().
Referenced by lockRegion().
bool ParFUMShadowArray::lockLocalNodes | ( | LockRegion * | region | ) |
Definition at line 369 of file ParFUM_SA.C.
References RegionID::chunkID, fmMesh, CkVec< T >::length(), RegionID::localID, LockRegion::localNodes, FEM_Entity::lookup(), LockRegion::myID, and FEM_Mesh::node.
bool ParFUMShadowArray::lockSharedIdxls | ( | LockRegion * | region | ) |
Lock the sharedidxls specified in the region.
If idx < chunkID of shared idxl, lock the idxl with chunkID on this chunk If we cant lock all the idxls we need to, clean up the locked ones and return false
Definition at line 399 of file ParFUM_SA.C.
References fmMesh, IDXL_Side::getIdxlListN(), idx, IDXL_List::isLocked(), CkVec< T >::length(), list, IDXL_List::lockIdxl(), FEM_Mesh::node, FEM_Node::shared, LockRegion::sharedIdxls, and IDXL_List::unlockIdxl().
void ParFUMShadowArray::lockRegionForRemote | ( | RegionID | regionID, | |
int * | sharedIdxls, | |||
int | numSharedIdxls, | |||
adaptAdj * | elements, | |||
int | numElements | |||
) |
Process a request from another chunk to lock these idxls and the nodes belonging to these elements.
Definition at line 436 of file ParFUM_SA.C.
References RegionID::chunkID, hasGreaterPrio(), holdingLock, idx, RegionID::localID, LockRegion::myID, pendingLock, RegionID::prio, CkHashtableTslow< KEY, OBJ >::put(), regionTable, and tag.
void ParFUMShadowArray::lockReply | ( | int | remoteChunk, | |
RegionID | regionID, | |||
int | foosuccess, | |||
int | tag, | |||
int | otherSuccess | |||
) |
Collect the replies from all the remote chunks that were requested to lock regions of the mesh.
If all chunks reply that they have locked successfully, then we just wake up the thread waiting for this region to lock. If some chunks fail, we need to unlock the region before replying
Definition at line 565 of file ParFUM_SA.C.
References RegionID::chunkID, CthAwaken(), CkHashtableT< KEY, OBJ >::get(), RegionID::localID, LockRegion::numReplies, RegionID::prio, regionTable, LockRegion::sharedIdxls, CkVec< T >::size(), LockRegion::success, LockRegion::tid, and unlockRegion().
void ParFUMShadowArray::unlockRegion | ( | LockRegion * | region | ) |
Free up all the local nodes, idxl and elements on remote chunk locked by this node.
Definition at line 644 of file ParFUM_SA.C.
References idx, CkVec< T >::length(), LockRegion::myID, LockRegion::numReplies, and LockRegion::sharedIdxls.
void ParFUMShadowArray::unlockLocalNodes | ( | LockRegion * | region | ) |
Definition at line 659 of file ParFUM_SA.C.
References RegionID::chunkID, fmMesh, CkVec< T >::length(), RegionID::localID, LockRegion::localNodes, FEM_Entity::lookup(), LockRegion::myID, FEM_Mesh::node, and FEM_Node::shared.
void ParFUMShadowArray::unlockSharedIdxls | ( | LockRegion * | region | ) |
Unlock all the shared idxl on this chunk.
Definition at line 677 of file ParFUM_SA.C.
References CmiAbort(), fmMesh, IDXL_Side::getIdxlListN(), idx, IDXL_List::isLocked(), CkVec< T >::length(), list, FEM_Mesh::node, FEM_Node::shared, LockRegion::sharedIdxls, and IDXL_List::unlockIdxl().
void ParFUMShadowArray::unlockForRemote | ( | RegionID | regionID | ) |
Unlock the local nodes and sharedIdxls locked for the remote region specified by regionID.
We need to send an ack back
Definition at line 697 of file ParFUM_SA.C.
References RegionID::chunkID, CkHashtableT< KEY, OBJ >::get(), holdingLock, idx, RegionID::localID, pendingLock, RegionID::prio, regionTable, and CkHashtableTslow< KEY, OBJ >::remove().
void ParFUMShadowArray::unpendForRemote | ( | RegionID | regionID | ) |
Definition at line 609 of file ParFUM_SA.C.
References RegionID::chunkID, CkHashtableT< KEY, OBJ >::get(), holdingLock, idx, RegionID::localID, pendingLock, regionTable, and CkHashtableTslow< KEY, OBJ >::remove().
Collect the replies to unlock requests from all the chunks that are involved in this region.
Once all the chunks have replied wake up the calling thread
Definition at line 719 of file ParFUM_SA.C.
References CthAwaken(), CkHashtableT< KEY, OBJ >::get(), CkVec< T >::length(), LockRegion::numReplies, regionTable, LockRegion::sharedIdxls, and LockRegion::tid.
void ParFUMShadowArray::freeRegion | ( | LockRegion * | region | ) |
Translates the sharedChk and the idxlType to the idxl side.
Helper function that translates the sharedChk and idxlType to the corresponding idxl_Side (FEM_Comm).
Definition at line 732 of file ParFUM_SA.C.
References FEM_Mesh::elem, fmMesh, FEM_Entity::ghost, FEM_Entity::ghostRecv, FEM_Entity::ghostSend, FEM_Mesh::node, and FEM_Node::shared.
Referenced by IdxlAddPrimary(), IdxlAddSecondary(), IdxlLookUpPrimary(), IdxlLookUpSecondary(), IdxlRemovePrimary(), and IdxlRemoveSecondary().
Add this 'localId' to this idxl list and return the shared entry index.
This operation adds an entry in the idxl list on the primary with 'sharedChk'.
The idxl list is again determined by idxlType. It retuns the index on the idxl list where it was added, which is used by the following operation. Note that here Primary does not have any relation to the global number, it is just the first chunk in the idxl pair where this entry is being added. The localId has a globalNo associated with it, so we just store the localId in the IDXL list, no change in IDXL necessary :)
Definition at line 762 of file ParFUM_SA.C.
References FindIdxlSide().
bool ParFUMShadowArray::IdxlAddSecondary | ( | int | localId, | |
int | sharedChk, | |||
int | sharedIdx, | |||
int | idxlType | |||
) |
Add this 'sharedIdx' to this idxl list.
This is pretty self-explanatory.
Add the entry 'loclaId' on the idxl list defined by 'idxltype' with 'sharedChk' at the location 'sharedIdx'. Returns success/failure
Definition at line 773 of file ParFUM_SA.C.
References FindIdxlSide().
Remove this 'localId' from this idxl list and return the shared entry index.
Search for this 'localId' on this idxl list and remove this entry.
and return the index, which will be used by the following operation.
Definition at line 783 of file ParFUM_SA.C.
References FindIdxlSide().
Remove the entry in this idxl list at index 'sharedIdx'.
Remove the entry that is at sharedIdx on the idxllist specified by sharedChk and IdxlType.
Definition at line 793 of file ParFUM_SA.C.
References FindIdxlSide().
Lookup this 'localId' in this idxl list and return the shared entry index.
Search for this localId in this Idxl list and return the entry index; Return -1 if it does not exist in this IDXL list.
Definition at line 800 of file ParFUM_SA.C.
References FindIdxlSide().
Return the localIdx at this 'sharedIdx' on this idxl list.
Return the localId at this index 'sharedIdx' on the idxl list specified by sharedChk and IdxlType.
Definition at line 810 of file ParFUM_SA.C.
References FindIdxlSide().
adaptAdjMsg * ParFUMShadowArray::remote_bulk_edge_bisect_2D | ( | adaptAdj & | nbrElem, | |
adaptAdj & | splitElem, | |||
int | new_idxl, | |||
int | n1_idxl, | |||
int | n2_idxl, | |||
int | partitionID | |||
) |
These are entry methods for bulk adaptivity.
Definition at line 816 of file ParFUM_SA.C.
References bulkAdapt, adaptAdjMsg::elem, and BulkAdapt::remote_edge_bisect_2D().
void ParFUMShadowArray::remote_adaptAdj_replace | ( | adaptAdj & | elem, | |
adaptAdj & | oldElem, | |||
adaptAdj & | newElem | |||
) |
Definition at line 830 of file ParFUM_SA.C.
References bulkAdapt, and BulkAdapt::remote_adaptAdj_replace().
void ParFUMShadowArray::remote_edgeAdj_replace | ( | int | remotePartID, | |
adaptAdj & | adj, | |||
adaptAdj & | elem, | |||
adaptAdj & | splitElem, | |||
int | n1_idxl, | |||
int | n2_idxl | |||
) |
Definition at line 835 of file ParFUM_SA.C.
References bulkAdapt, and BulkAdapt::remote_edgeAdj_replace().
void ParFUMShadowArray::remote_edgeAdj_add | ( | int | remotePartID, | |
adaptAdj & | adj, | |||
adaptAdj & | splitElem, | |||
int | n1_idxl, | |||
int | n2_idxl | |||
) |
Definition at line 844 of file ParFUM_SA.C.
References bulkAdapt, and BulkAdapt::remote_edgeAdj_add().
void ParFUMShadowArray::recv_split_3D | ( | int | pos, | |
int | tableID, | |||
adaptAdj & | elem, | |||
adaptAdj & | splitElem | |||
) |
Definition at line 851 of file ParFUM_SA.C.
References bulkAdapt, and BulkAdapt::recv_split_3D().
void ParFUMShadowArray::handle_split_3D | ( | int | remotePartID, | |
int | pos, | |||
int | tableID, | |||
adaptAdj & | elem, | |||
RegionID | lockRegionID, | |||
int | n1_idxl, | |||
int | n2_idxl, | |||
int | n5_idxl | |||
) |
Definition at line 857 of file ParFUM_SA.C.
References bulkAdapt, BulkAdapt::handle_split_3D(), and holdingLock.
Definition at line 866 of file ParFUM_SA.C.
References BulkAdapt::all_splits_received(), bulkAdapt, and CthYield().
Referenced by BulkAdapt::edge_bisect_3D().
longestMsg * ParFUMShadowArray::isLongest | ( | int | elem, | |
int | elemType, | |||
double | len | |||
) |
Definition at line 823 of file ParFUM_SA.C.
References bulkAdapt, BulkAdapt::isLongest(), longestMsg::longest, and PUP::m.
void ParFUMShadowArray::update_asterisk_3D | ( | int | remotePartID, | |
int | i, | |||
adaptAdj & | elem, | |||
int | numElemPairs, | |||
adaptAdj * | elemPairs, | |||
RegionID | lockRegionID, | |||
int | n1_idxl, | |||
int | n2_idxl, | |||
int | n5_idxl | |||
) |
Definition at line 872 of file ParFUM_SA.C.
References bulkAdapt, holdingLock, and BulkAdapt::update_asterisk_3D().
int ParFUMShadowArray::numChunks [private] |
Total number of chunks.
Definition at line 71 of file ParFUM_SA.h.
Referenced by getNumChunks(), ParFUMShadowArray(), and pup().
int ParFUMShadowArray::idx [private] |
Index of this chunk (the chunk this is attached to).
Definition at line 73 of file ParFUM_SA.h.
Referenced by ckJustMigrated(), collectLocalNodes(), getIdx(), lockRegion(), lockRegionForRemote(), lockSharedIdxls(), ParFUMShadowArray(), pup(), setFemMesh(), unlockForRemote(), unlockRegion(), unlockSharedIdxls(), unpendForRemote(), and unpendRegion().
TCharm* ParFUMShadowArray::tc [private] |
The Tcharm pointer to set it even outside the thread..
Definition at line 75 of file ParFUM_SA.h.
Referenced by ckJustMigrated(), ParFUMShadowArray(), setFemMesh(), and setRunningTCharm().
CProxy_TCharm ParFUMShadowArray::tproxy [private] |
The proxy for the current Tcharm object.
Definition at line 77 of file ParFUM_SA.h.
Referenced by ckJustMigrated(), pup(), and setFemMesh().
FEM_Mesh* ParFUMShadowArray::fmMesh [private] |
cross-pointer to the fem mesh on this chunk
Definition at line 79 of file ParFUM_SA.h.
Referenced by ckJustMigrated(), collectLocalNodes(), FindIdxlSide(), getfmMesh(), lockLocalNodes(), lockRegion(), lockSharedIdxls(), ParFUMShadowArray(), setFemMesh(), unlockLocalNodes(), and unlockSharedIdxls().
Deprecated: used to lock this chunk.
Definition at line 81 of file ParFUM_SA.h.
Referenced by lockRegion(), lockRegionForRemote(), lockReply(), unlockForRemote(), unlockRegion(), unlockReply(), unpendForRemote(), and unpendRegion().
int ParFUMShadowArray::regionCount [private] |
Definition at line 85 of file ParFUM_SA.h.
Referenced by handle_split_3D(), isLongest(), recv_split_3D(), recv_splits(), Bulk_Adapt::Refine_h(), remote_adaptAdj_replace(), remote_bulk_edge_bisect_2D(), remote_edgeAdj_add(), remote_edgeAdj_replace(), setFemMesh(), and update_asterisk_3D().
Definition at line 86 of file ParFUM_SA.h.
Referenced by BulkAdapt::edge_bisect_3D(), handle_split_3D(), lockRegion(), lockRegionForRemote(), ParFUMShadowArray(), Bulk_Adapt::Refine_h(), unlockForRemote(), unlockRegion(), unpendForRemote(), unpendRegion(), and update_asterisk_3D().
Definition at line 87 of file ParFUM_SA.h.
Referenced by lockRegion(), lockRegionForRemote(), ParFUMShadowArray(), unlockForRemote(), unlockRegion(), unpendForRemote(), and unpendRegion().