-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriteMeshToFile.cpp
More file actions
38 lines (31 loc) · 977 Bytes
/
Copy pathwriteMeshToFile.cpp
File metadata and controls
38 lines (31 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* \copyright
* Copyright (c) 2012-2015, 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"
#include <logog/include/logog.hpp>
#include "BaseLib/FileTools.h"
#include "BaseLib/StringTools.h"
#include "MeshLib/Mesh.h"
#include "Legacy/MeshIO.h"
#include "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.setMesh(&mesh);
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