mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-25 04:10:33 +05:00
Medit format fixes
This commit is contained in:
parent
b8fe52edf2
commit
790f4784ed
@ -1,3 +1,5 @@
|
|||||||
|
#include <regex>
|
||||||
|
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
#include "rw_medit.hpp"
|
#include "rw_medit.hpp"
|
||||||
|
|
||||||
@ -6,6 +8,8 @@ namespace netgen
|
|||||||
void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map<tuple<int,int>, int> & index_map)
|
void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map<tuple<int,int>, int> & index_map)
|
||||||
{
|
{
|
||||||
static Timer tall("ReadMeditMesh"); RegionTimer rtall(tall);
|
static Timer tall("ReadMeditMesh"); RegionTimer rtall(tall);
|
||||||
|
if(!filesystem::exists(filename))
|
||||||
|
throw Exception("File does not exist: " + filename.string());
|
||||||
auto fin = ifstream(filename);
|
auto fin = ifstream(filename);
|
||||||
string token;
|
string token;
|
||||||
int version, dim;
|
int version, dim;
|
||||||
@ -28,9 +32,12 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map<tuple<
|
|||||||
while(true) {
|
while(true) {
|
||||||
fin >> token;
|
fin >> token;
|
||||||
int index;
|
int index;
|
||||||
if(token == "End")
|
if(token == "End") {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
else if(token == "" || std::regex_match(token, std::regex("^[\\s]*$"))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if(token == "MeshVersionFormatted") {
|
else if(token == "MeshVersionFormatted") {
|
||||||
fin >> version;
|
fin >> version;
|
||||||
}
|
}
|
||||||
@ -124,8 +131,8 @@ void WriteMeditFormat (const Mesh & mesh, const filesystem::path & filename, map
|
|||||||
for(const auto & p : mesh.Points())
|
for(const auto & p : mesh.Points())
|
||||||
{
|
{
|
||||||
for(auto i : Range(mesh.GetDimension()))
|
for(auto i : Range(mesh.GetDimension()))
|
||||||
fout << setw(20) << p[i];
|
fout << p[i] << ' ';
|
||||||
fout << setw(6) << getIndex(1, 0) << endl;
|
fout << getIndex(1, 0) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
base_index = max_index;
|
base_index = max_index;
|
||||||
|
Loading…
Reference in New Issue
Block a user