00001 //*****************************************************************// 00002 // Albany 2.0: Copyright 2012 Sandia Corporation // 00003 // This Software is released under the BSD license detailed // 00004 // in the file "license.txt" in the top-level Albany directory // 00005 //*****************************************************************// 00006 00007 00008 #ifndef ADAPT_NODALDATABLOCK_HPP 00009 #define ADAPT_NODALDATABLOCK_HPP 00010 00011 #include "Teuchos_RCP.hpp" 00012 #include "Albany_DataTypes.hpp" 00013 #include "Albany_AbstractNodeFieldContainer.hpp" 00014 #include "Phalanx_DataLayout.hpp" 00015 00016 namespace Adapt { 00017 00022 class NodalDataBlock { 00023 00024 public: 00025 00026 NodalDataBlock(); 00027 00029 virtual ~NodalDataBlock(){} 00030 00031 void resizeLocalMap(const std::vector<int>& local_nodeGIDs, const Epetra_Comm& comm); 00032 00033 void resizeOverlapMap(const std::vector<int>& overlap_nodeGIDs, const Epetra_Comm& comm); 00034 00035 Teuchos::RCP<Epetra_Vector> getOverlapNodeVec(){ return overlap_node_vec; } 00036 Teuchos::RCP<Epetra_Vector> getLocalNodeVec(){ return local_node_vec; } 00037 00038 Teuchos::RCP<const Epetra_BlockMap> getOverlapMap() const { return overlap_node_map; } 00039 Teuchos::RCP<const Epetra_BlockMap> getLocalMap() const { return local_node_map; } 00040 00041 void initializeVectors(double value){overlap_node_vec->PutScalar(value); local_node_vec->PutScalar(value); } 00042 00043 void initializeExport(); 00044 00045 void exportAddNodalDataBlock(); 00046 00047 void saveNodalDataState() const; 00048 00049 void saveEpetraNodalDataVector(const std::string& name, const Teuchos::RCP<const Epetra_Vector>& overlap_node_vec, 00050 int offset, int blocksize) const; 00051 00052 int getBlocksize(){ return blocksize; } 00053 00054 void getNDofsAndOffset(const std::string &stateName, int& offset, int& ndofs) const; 00055 00056 void registerState(const std::string &stateName, int ndofs); 00057 00058 Teuchos::RCP<Albany::NodeFieldContainer> getNodeContainer(){ return nodeContainer; } 00059 00060 00061 private: 00062 00063 struct NodeFieldSize { 00064 00065 std::string name; 00066 int offset; 00067 int ndofs; 00068 00069 }; 00070 00071 typedef std::vector<NodeFieldSize> NodeFieldSizeVector; 00072 typedef std::map<const std::string, std::size_t> NodeFieldSizeMap; 00073 00074 Teuchos::RCP<const Epetra_BlockMap> overlap_node_map; 00075 Teuchos::RCP<const Epetra_BlockMap> local_node_map; 00076 00077 Teuchos::RCP<Epetra_Vector> overlap_node_vec; 00078 Teuchos::RCP<Epetra_Vector> local_node_vec; 00079 00080 Teuchos::RCP<Epetra_Import> importer; 00081 00082 Teuchos::RCP<Albany::NodeFieldContainer> nodeContainer; 00083 00084 NodeFieldSizeVector nodeBlockLayout; 00085 NodeFieldSizeMap nodeBlockMap; 00086 00087 int blocksize; 00088 00089 bool mapsHaveChanged; 00090 00091 }; 00092 00093 00094 } 00095 00096 #endif // ADAPT_NODALDATABLOCK_HPP