Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "AlbPUMI_FMDBExodus.hpp"
00008
00009 #include <stk_mesh/fem/FEMMetaData.hpp>
00010 #include <stk_mesh/base/BulkData.hpp>
00011 #include <stk_io/MeshReadWriteUtils.hpp>
00012 #include <stk_io/IossBridge.hpp>
00013 #include <Ionit_Initializer.h>
00014
00015 #include <pumi_mesh.h>
00016 #include <apfPUMI.h>
00017 #include <apfSTK.h>
00018
00019 AlbPUMI::FMDBExodus::
00020 FMDBExodus(FMDBMeshStruct& meshStruct, const Teuchos::RCP<const Epetra_Comm>& comm_) {
00021 apfMesh = meshStruct.apfMesh;
00022 outputFileName = meshStruct.outputFileName;
00023 }
00024
00025 AlbPUMI::FMDBExodus::
00026 ~FMDBExodus() {
00027 }
00028
00029 void
00030 AlbPUMI::FMDBExodus::
00031 write(const char* filename, const double time_val) {
00032 pMeshMdl mesh = apf::getPumiPart(apfMesh)->getMesh();
00033 PUMI_Exodus_Init(mesh);
00034 stk::mesh::fem::FEMMetaData* metaData;
00035 metaData = new stk::mesh::fem::FEMMetaData();
00036 PUMI_Mesh_CopyToMetaData(mesh,metaData);
00037 apf::copyToMetaData(apfMesh,metaData);
00038 metaData->commit();
00039 stk::mesh::BulkData* bulkData;
00040 bulkData = new stk::mesh::BulkData(
00041 stk::mesh::fem::FEMMetaData::get_meta_data(*metaData),
00042 MPI_COMM_WORLD);
00043 PUMI_Mesh_CopyToBulkData(mesh,metaData,*bulkData);
00044 apf::copyToBulkData(apfMesh,metaData,bulkData);
00045 Ioss::Init::Initializer();
00046 stk::io::MeshData* meshData;
00047 meshData = new stk::io::MeshData();
00048 stk::io::create_output_mesh(
00049 filename,
00050 MPI_COMM_WORLD,
00051 *bulkData,
00052 *meshData);
00053 stk::io::define_output_fields(*meshData,*metaData);
00054 stk::io::process_output_request(*meshData,*bulkData,time_val);
00055 delete meshData;
00056 delete bulkData;
00057 delete metaData;
00058 PUMI_Exodus_Finalize(mesh);
00059 }
00060
00061 void
00062 AlbPUMI::FMDBExodus::
00063 writeFile(const double time_val) {
00064 write(outputFileName.c_str(),time_val);
00065 }
00066
00067 void
00068 AlbPUMI::FMDBExodus::
00069 debugMeshWrite(const char* fn){
00070 std::string filename = fn;
00071 filename += ".exo";
00072 write(filename.c_str(),0.0);
00073 }
00074