Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include <iostream>
00008
00009 #ifdef ALBANY_CUTR
00010
00011 #include "Albany_FromCubitSTKMeshStruct.hpp"
00012
00013
00014 #include "STKMeshData.hpp"
00015
00016 #include <Shards_BasicTopologies.hpp>
00017
00018 #include <stk_mesh/base/Entity.hpp>
00019 #include <stk_mesh/base/GetEntities.hpp>
00020 #include <stk_mesh/base/GetBuckets.hpp>
00021 #include <stk_mesh/base/FieldData.hpp>
00022 #include <stk_mesh/base/Selector.hpp>
00023
00024 #include <stk_mesh/fem/FieldDeclarations.hpp>
00025 #include <stk_mesh/fem/FEMHelpers.hpp>
00026 #include <stk_mesh/fem/EntityRanks.hpp>
00027 #include "Albany_Utils.hpp"
00028
00029 enum { field_data_chunk_size = 1001 };
00030
00031
00032 Albany::FromCubitSTKMeshStruct::FromCubitSTKMeshStruct(
00033 const Teuchos::RCP<CUTR::CubitMeshMover>& meshMover,
00034 const Teuchos::RCP<Teuchos::ParameterList>& params,
00035 const unsigned int neq_,
00036 const Teuchos::RCP<Albany::StateInfoStruct>& sis,
00037 ) :
00038 periodic(params->get("Periodic BC", false))
00039 {
00040 params->validateParameters(*getValidDiscretizationParameters(),0);
00041 neq=neq_;
00042
00043
00044 STKMeshData* stkMeshData = STKMeshData::instance();
00045
00046 metaData = stkMeshData->get_meta_data();
00047 coordinates_field = stkMeshData->get_coords_field();
00048
00049 solution_field = & metaData->declare_field< VectorFieldType >( "solution" );
00050 residual_field = & metaData->declare_field< VectorFieldType >( "residual" );
00051 stk::mesh::put_field( *solution_field , metaData->node_rank() , metaData->universal_part(), neq );
00052 stk::mesh::put_field( *residual_field , metaData->node_rank() , metaData->universal_part() , neq );
00053
00054
00055 std::map<int, stk::mesh::Part*> nsList= stkMeshData->get_nodeset_list();
00056 std::map<int, stk::mesh::Part*>::iterator ns = nsList.begin();
00057 while ( ns != nsList.end() ) {
00058
00059 std::stringstream ss; ss << "nodelist_" << ns->first;
00060 nsPartVec[ss.str()] = ns->second;
00061 #ifdef ALBANY_SEACAS
00062 stk::io::put_io_part_attribute(*ns->second);
00063 #endif
00064 ns++;
00065 }
00066
00067 numDim = stkMeshData->get_num_dim();
00068
00069 if (numDim==2) partVec[0] = stkMeshData->surface_part(0);
00070 else partVec[0] = stkMeshData->volume_part(0);
00071
00072 #ifdef ALBANY_SEACAS
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 stk::io::set_field_role(*coordinates_field, Ioss::Field::TRANSIENT);
00085 stk::io::set_field_role(*solution_field, Ioss::Field::TRANSIENT);
00086 stk::io::set_field_role(*residual_field, Ioss::Field::TRANSIENT);
00087 #endif
00088
00089
00090 stkMeshData->declare_geometry_complete();
00091
00092
00093 stkMeshData->begin_declare_entities();
00094 meshMover->construct_bulkdata();
00095 stkMeshData->end_declare_entities();
00096 bulkData = stkMeshData->get_bulk_data();
00097
00098 meshMover->set_morph_method(params->get("Morph Method", 0));
00099
00100 cubatureDegree = params->get("Cubature Degree", 3);
00101
00102 cout << "FromCubitSTKMeshStruct: numDim = " << numDim
00103 << " nodesets = " << nsPartVec.size() << endl;
00104 useElementAsTopRank = false;
00105
00106 exoOutput = params->isType<string>("Exodus Output File Name");
00107 if (exoOutput)
00108 exoOutFile = params->get<string>("Exodus Output File Name");
00109 cdfOutput = params->isType<string>("NetCDF Output File Name");
00110 if (cdfOutput)
00111 cdfOutFile = params->get<string>("NetCDF Output File Name");
00112 nLat = params->get("NetCDF Output Number of Latitudes",100);
00113 nLon = params->get("NetCDF Output Number of Longitudes",100);
00114
00115
00116 transformType = params->get("Transform Type", "None");
00117 felixAlpha = params->get("FELIX alpha", 0.0);
00118 felixL = params->get("FELIX L", 1.0);
00119
00120
00121 contigIDs = params->get("Contiguous IDs", true);
00122
00123
00124 writeCoordsToMMFile = params->get("Write Coordinates to MatrixMarket", false);
00125 }
00126
00127 Albany::FromCubitSTKMeshStruct::~FromCubitSTKMeshStruct()
00128 {
00129 }
00130
00131
00132 Teuchos::RCP<const Teuchos::ParameterList>
00133 Albany::FromCubitSTKMeshStruct::getValidDiscretizationParameters() const
00134 {
00135 Teuchos::RCP<Teuchos::ParameterList> validPL =
00136 rcp(new Teuchos::ParameterList("ValidCubit_DiscParams"));;
00137 validPL->set<bool>("Periodic BC", false, "Flag to indicate periodic a mesh");
00138 validPL->set<int>("Morph Method", 0, "Integer flag so select CUTR MeshMover Morph Method");
00139 validPL->set<std::string>("Exodus Output File Name", "",
00140 "Request exodus output to given file name. Requires SEACAS build");
00141 validPL->set<std::string>("NetCDF Output File Name", "",
00142 "Request netcdf output to given file name. Requires SEACAS build");
00143 validPL->set<int>("NetCDF Output Number of Latitudes", 1,
00144 "Number of samples in Latitude direction for NetCDF output. Default is 100.");
00145 validPL->set<int>("NetCDF Output Number of Longitudes", 1,
00146 "Number of samples in Longitude direction for NetCDF output. Default is 100.");
00147 validPL->set<std::string>("Method", "",
00148 "The discretization method, parsed in the Discretization Factory");
00149 validPL->set<int>("Cubature Degree", 3, "Integration order sent to Intrepid");
00150
00151 return validPL;
00152 }
00153
00154 #endif