00001
00002
00003
00004
00005
00006 #ifndef ALBANY_ASCII_STKMESH3DSTRUCT_HPP
00007 #define ALBANY_ASCII_STKMESH3DSTRUCT_HPP
00008
00009 #include "Albany_GenericSTKMeshStruct.hpp"
00010 #include <string>
00011 #include <iostream>
00012
00013
00014
00015 namespace Albany {
00016
00017 class ExtrudedSTKMeshStruct : public GenericSTKMeshStruct {
00018
00019 public:
00020
00021 ExtrudedSTKMeshStruct(
00022 const Teuchos::RCP<Teuchos::ParameterList>& params,
00023 const Teuchos::RCP<const Epetra_Comm>& epetra_comm);
00024
00025 ~ExtrudedSTKMeshStruct();
00026
00027 void setFieldAndBulkData(
00028 const Teuchos::RCP<const Epetra_Comm>& comm,
00029 const Teuchos::RCP<Teuchos::ParameterList>& params,
00030 const unsigned int neq_,
00031 const AbstractFieldContainer::FieldContainerRequirements& req,
00032 const Teuchos::RCP<Albany::StateInfoStruct>& sis,
00033 const unsigned int worksetSize);
00034
00036 bool hasRestartSolution() const {return false; }
00037
00039 double restartDataTime() const {return -1.0; }
00040
00041 private:
00042
00043
00044 Teuchos::RCP<Albany::GenericSTKMeshStruct> meshStruct2D;
00045
00046 inline void computeMap();
00047 inline int prismType(long long int const* prismVertexMpasIds, int& minIndex);
00048 inline void tetrasFromPrismStructured (long long int const* prismVertexMpasIds, long long int const* prismVertexGIds, long long int tetrasIdsOnPrism[][4]);
00049 void read2DFileSerial(std::string &fname, Epetra_Vector& content, const Teuchos::RCP<const Epetra_Comm>& comm);
00050 void readFileSerial(std::string &fname, std::vector<Epetra_Vector>& contentVec, const Teuchos::RCP<const Epetra_Comm>& comm);
00051 void readFileSerial(std::string &fname, const Epetra_Map& map_serial, const Epetra_Map& map, const Epetra_Import& importOperator, std::vector<Epetra_Vector>& temperatureVec, std::vector<double>& zCoords, const Teuchos::RCP<const Epetra_Comm>& comm);
00052
00053
00054 Teuchos::RCP<const Teuchos::ParameterList>
00055 getValidDiscretizationParameters() const;
00056
00057 Teuchos::RCP<Teuchos::FancyOStream> out;
00058 bool periodic;
00059 enum elemShapeType {Tetrahedron, Wedge, Hexahedron};
00060 elemShapeType ElemShape;
00061 int NumBaseElemeNodes;
00062 int NumNodes;
00063 int NumEles;
00064 int NumBdEdges;
00065 };
00066
00067
00068
00069 int ExtrudedSTKMeshStruct::prismType(long long int const* prismVertexMpasIds, int& minIndex)
00070 {
00071 int PrismVerticesMap[6][6] = {{0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}, {3, 5, 4, 0, 2, 1}, {4, 3, 5, 1, 0, 2}, {5, 4, 3, 2, 1, 0}};
00072 minIndex = std::min_element (prismVertexMpasIds, prismVertexMpasIds + 3) - prismVertexMpasIds;
00073
00074 int v1 (prismVertexMpasIds[PrismVerticesMap[minIndex][1]]);
00075 int v2 (prismVertexMpasIds[PrismVerticesMap[minIndex][2]]);
00076
00077 return v1 > v2;
00078 }
00079
00080 void ExtrudedSTKMeshStruct::tetrasFromPrismStructured (long long int const* prismVertexMpasIds, long long int const* prismVertexGIds, long long int tetrasIdsOnPrism[][4])
00081 {
00082 int PrismVerticesMap[6][6] = {{0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}, {3, 5, 4, 0, 2, 1}, {4, 3, 5, 1, 0, 2}, {5, 4, 3, 2, 1, 0}};
00083
00084 int tetraOfPrism[2][3][4] = {{{0, 1, 2, 5}, {0, 1, 5, 4}, {0, 4, 5, 3}}, {{0, 1, 2, 4}, {0, 4, 2, 5}, {0, 4, 5, 3}}};
00085
00086 int tetraAdjacentToPrismLateralFace[2][3][2] = {{{1, 2}, {0, 1}, {0, 2}}, {{0, 2}, {0, 1}, {1, 2}}};
00087 int tetraFaceIdOnPrismLateralFace[2][3][2] = {{{0, 0}, {1, 1}, {2, 2}}, {{0, 0}, {1, 1}, {2, 2}}};
00088 int tetraAdjacentToBottomFace = 0;
00089 int tetraAdjacentToUpperFace = 2;
00090 int tetraFaceIdOnBottomFace = 3;
00091 int tetraFaceIdOnUpperFace = 0;
00092
00093 int minIndex;
00094 int prismType = this->prismType(prismVertexMpasIds, minIndex);
00095
00096 long long int reorderedPrismLIds[6];
00097
00098 for (int ii = 0; ii < 6; ii++)
00099 {
00100 reorderedPrismLIds[ii] = prismVertexGIds[PrismVerticesMap[minIndex][ii]];
00101 }
00102
00103 for (int iTetra = 0; iTetra < 3; iTetra++)
00104 for (int iVertex = 0; iVertex < 4; iVertex++)
00105 {
00106 tetrasIdsOnPrism[iTetra][iVertex] = reorderedPrismLIds[tetraOfPrism[prismType][iTetra][iVertex]];
00107 }
00108 }
00109
00110
00111 void ExtrudedSTKMeshStruct::computeMap()
00112 {
00113 int PrismVerticesMap[6][6] = {{0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}, {3, 5, 4, 0, 2, 1}, {4, 3, 5, 1, 0, 2}, {5, 4, 3, 2, 1, 0}};
00114
00115 int tetraOfPrism[2][3][4] = {{{0, 1, 2, 5}, {0, 1, 5, 4}, {0, 4, 5, 3}}, {{0, 1, 2, 4}, {0, 4, 2, 5}, {0, 4, 5, 3}}};
00116
00117 int TetraFaces[4][3] = {{0 , 1 , 3}, {1 , 2 , 3}, {0 , 3 , 2}, {0 , 2 , 1}};
00118
00119 int PrismFaces[5][4] = {{0 , 1 , 4 , 3}, {1 , 2 , 5 , 4}, {0 , 3 , 5 , 2}, {0 , 2 , 1 , -1}, {3 , 4 , 5, -1}};
00120
00121
00122 for(int pType=0; pType<2; ++pType){
00123 std::cout<< "pType: " << pType <<std::endl;
00124 for(int minIndex = 0; minIndex<6; ++minIndex){
00125 std::cout<< "mIndex: " << minIndex <<std::endl;
00126 for(int pFace = 0; pFace<5; ++pFace){
00127 for(int tFace =0; tFace<4; ++tFace){
00128 for(int iTetra =0; iTetra<3; ++iTetra){
00129 int count=0;
00130 for(int in =0; in<3; ++in){
00131 int node=PrismVerticesMap[minIndex][tetraOfPrism[pType][iTetra][TetraFaces[tFace][in]]];
00132 for(int i=0; i<4; ++i)
00133 count += (node == PrismFaces[pFace][i]);
00134 }
00135 if(count == 3)
00136 std::cout << pFace << " " << tFace << " " << iTetra << std::endl;
00137 }
00138 }
00139 }
00140 }
00141 std::cout<<std::endl;
00142 }
00143 std::cout<<std::endl;
00144 }
00145 }
00146 #endif