Skip to content
Snippets Groups Projects
Commit 01868984 authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

add writeMeshToFile

parent 8630d110
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@ SET( SOURCES
TINInterface.cpp
Writer.h
Writer.cpp
writeMeshToFile.h
writeMeshToFile.cpp
)
GET_SOURCE_FILES(SOURCES_LEGACY Legacy)
......
/**
* \copyright
* Copyright (c) 2012-2014, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include "writeMeshToFile.h"
// ThirdParty/logog
#include "logog/include/logog.hpp"
// BaseLib
#include "FileTools.h"
#include "StringTools.h"
// MeshLib
#include "Mesh.h"
// FileIO
#include "Legacy/MeshIO.h"
#include "FileIO/VtkIO/VtuInterface.h"
namespace FileIO
{
void writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name)
{
if (BaseLib::hasFileExtension("msh", file_name))
{
Legacy::MeshIO meshIO;
meshIO.writeToFile(file_name);
} else if (BaseLib::hasFileExtension("vtu", file_name)) {
FileIO::VtuInterface writer(&mesh);
writer.writeToFile(file_name);
} else {
ERR("writeMeshToFile(): Unknown mesh file format in file %s.", file_name.c_str());
}
}
} // end namespace FileIO
/**
* \copyright
* Copyright (c) 2012-2014, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#ifndef WRITEMESHTOFILE_H_
#define WRITEMESHTOFILE_H_
#include <string>
namespace MeshLib
{
class Mesh;
}
namespace FileIO
{
void writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name);
}
#endif // WRITEMESHTOFILE_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment