mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
add message level and check notation of unv file only for first line
This commit is contained in:
parent
6e18260ef7
commit
267959967d
@ -29,7 +29,7 @@ namespace netgen
|
|||||||
|
|
||||||
if ( ext == ".surf" )
|
if ( ext == ".surf" )
|
||||||
{
|
{
|
||||||
cout << "Surface file" << endl;
|
cout << IM(3) << "Surface file" << endl;
|
||||||
|
|
||||||
ifstream in (filename);
|
ifstream in (filename);
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cout << "points: " << np << " faces: " << nbe << endl;
|
cout << IM(3) << "points: " << np << " faces: " << nbe << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ namespace netgen
|
|||||||
|
|
||||||
else if (strcmp (reco, "2411") == 0)
|
else if (strcmp (reco, "2411") == 0)
|
||||||
{
|
{
|
||||||
cout << "nodes found" << endl;
|
cout << IM(3) << "nodes found" << endl;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -118,25 +118,30 @@ namespace netgen
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
in >> hi >> hi >> hi;
|
in >> hi >> hi >> hi;
|
||||||
|
// check if D in first line
|
||||||
if (DnotationSet == false) {
|
if (DnotationSet == false) {
|
||||||
in >> p1tmp >> p2tmp >> p3tmp;
|
in >> p1tmp >> p2tmp >> p3tmp;
|
||||||
if (p1tmp.find("D") != std::string::npos){
|
if (p1tmp.find("D") != std::string::npos){
|
||||||
DnotationSet = true;
|
|
||||||
Dnotation = true;
|
Dnotation = true;
|
||||||
cout << "Attention: in your UNV file, D is used as an exponent prefix instead of E" << endl;
|
cout << IM(3) << "Attention: in your UNV file, D is used as an exponent prefix instead of E" << endl;
|
||||||
std::replace( p1tmp.begin(), p1tmp.end(), 'D', 'E');
|
std::replace(p1tmp.begin(), p1tmp.end(), 'D', 'E');
|
||||||
std::replace( p2tmp.begin(), p2tmp.end(), 'D', 'E');
|
std::replace(p2tmp.begin(), p2tmp.end(), 'D', 'E');
|
||||||
std::replace( p3tmp.begin(), p3tmp.end(), 'D', 'E');
|
std::replace(p3tmp.begin(), p3tmp.end(), 'D', 'E');
|
||||||
}
|
}
|
||||||
p(0) = std::stod(p1tmp);
|
p(0) = std::stod(p1tmp);
|
||||||
p(1) = std::stod(p2tmp);
|
p(1) = std::stod(p2tmp);
|
||||||
p(2) = std::stod(p3tmp);
|
p(2) = std::stod(p3tmp);
|
||||||
|
mesh.AddPoint(p);
|
||||||
|
|
||||||
|
DnotationSet = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (Dnotation == true) {
|
|
||||||
|
if (Dnotation == true) {
|
||||||
in >> p1tmp >> p2tmp >> p3tmp;
|
in >> p1tmp >> p2tmp >> p3tmp;
|
||||||
std::replace( p1tmp.begin(), p1tmp.end(), 'D', 'E');
|
std::replace(p1tmp.begin(), p1tmp.end(), 'D', 'E');
|
||||||
std::replace( p2tmp.begin(), p2tmp.end(), 'D', 'E');
|
std::replace(p2tmp.begin(), p2tmp.end(), 'D', 'E');
|
||||||
std::replace( p3tmp.begin(), p3tmp.end(), 'D', 'E');
|
std::replace(p3tmp.begin(), p3tmp.end(), 'D', 'E');
|
||||||
p(0) = std::stod(p1tmp);
|
p(0) = std::stod(p1tmp);
|
||||||
p(1) = std::stod(p2tmp);
|
p(1) = std::stod(p2tmp);
|
||||||
p(2) = std::stod(p3tmp);
|
p(2) = std::stod(p3tmp);
|
||||||
@ -146,14 +151,14 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
mesh.AddPoint(p);
|
mesh.AddPoint(p);
|
||||||
}
|
}
|
||||||
cout << "read " << mesh.GetNP() << " points" << endl;
|
cout << IM(3) << "read " << mesh.GetNP() << " points" << endl;
|
||||||
Point3d pmin, pmax;
|
Point3d pmin, pmax;
|
||||||
cout << "Get Box" << endl;
|
cout << IM(5) << "Get Box" << endl;
|
||||||
mesh.GetBox (pmin, pmax);
|
mesh.GetBox (pmin, pmax);
|
||||||
cout << "Pmin: " << pmin << " Pmax: " << pmax << endl;
|
cout << IM(5) << "Pmin: " << pmin << " Pmax: " << pmax << endl;
|
||||||
if(fabs(pmin.Z() - pmax.Z()) < 1e-10 * Dist(pmin, pmax))
|
if(fabs(pmin.Z() - pmax.Z()) < 1e-10 * Dist(pmin, pmax))
|
||||||
{
|
{
|
||||||
cout << "Set Dimension to 2." << endl;
|
cout << IM(5) << "Set Dimension to 2." << endl;
|
||||||
mesh.SetDimension(2);
|
mesh.SetDimension(2);
|
||||||
dim = 2 ;
|
dim = 2 ;
|
||||||
}
|
}
|
||||||
@ -162,7 +167,7 @@ namespace netgen
|
|||||||
|
|
||||||
else if (strcmp (reco, "2412") == 0)
|
else if (strcmp (reco, "2412") == 0)
|
||||||
{
|
{
|
||||||
cout << "elements found" << endl;
|
cout << IM(3) << "elements found" << endl;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -266,18 +271,18 @@ namespace netgen
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
cout << "Do not know fe_id = " << fe_id << ", skipping it." << endl;
|
cout << IM(3) << "Do not know fe_id = " << fe_id << ", skipping it." << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << mesh.GetNE() << " elements found" << endl;
|
cout << IM(3) << mesh.GetNE() << " elements found" << endl;
|
||||||
cout << mesh.GetNSE() << " surface elements found" << endl;
|
cout << IM(3) << mesh.GetNSE() << " surface elements found" << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(strcmp (reco, "2467") == 0)
|
else if(strcmp (reco, "2467") == 0)
|
||||||
{
|
{
|
||||||
int matnr = 1;
|
int matnr = 1;
|
||||||
cout << "Groups found" << endl;
|
cout << IM(3) << "Groups found" << endl;
|
||||||
while(in.good())
|
while(in.good())
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
@ -288,7 +293,7 @@ namespace netgen
|
|||||||
for(int i=0; i < 7; i++)
|
for(int i=0; i < 7; i++)
|
||||||
in >> len;
|
in >> len;
|
||||||
in >> name;
|
in >> name;
|
||||||
cout << len << " element are in group " << name << endl;
|
cout << IM(3) << len << " element are in group " << name << endl;
|
||||||
int hi, index;
|
int hi, index;
|
||||||
int fdnr, ednr;
|
int fdnr, ednr;
|
||||||
|
|
||||||
@ -350,7 +355,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
cout << "Codim " << codim << " not implemented yet!" << endl;
|
cout << IM(3) << "Codim " << codim << " not implemented yet!" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +394,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "Do not know data field type " << reco << ", skipping it" << endl;
|
cout << IM(3) << "Do not know data field type " << reco << ", skipping it" << endl;
|
||||||
while(in.good())
|
while(in.good())
|
||||||
{
|
{
|
||||||
in >> reco;
|
in >> reco;
|
||||||
@ -414,22 +419,22 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cout << "Finalize mesh" << endl;
|
cout << IM(5) << "Finalize mesh" << endl;
|
||||||
Point3d pmin, pmax;
|
Point3d pmin, pmax;
|
||||||
cout << "ComputeNVertices" << endl;
|
cout << IM(5) << "ComputeNVertices" << endl;
|
||||||
mesh.ComputeNVertices();
|
mesh.ComputeNVertices();
|
||||||
cout << "RebuildSurfaceElementLists" << endl;
|
cout << IM(5) << "RebuildSurfaceElementLists" << endl;
|
||||||
mesh.RebuildSurfaceElementLists();
|
mesh.RebuildSurfaceElementLists();
|
||||||
cout << "GetBox" << endl;
|
cout << IM(5) << "GetBox" << endl;
|
||||||
mesh.GetBox (pmin, pmax);
|
mesh.GetBox (pmin, pmax);
|
||||||
cout << "UpdateTopology" << endl;
|
cout << IM(5) << "UpdateTopology" << endl;
|
||||||
mesh.UpdateTopology();
|
mesh.UpdateTopology();
|
||||||
cout << "increment bccounter" << endl;
|
cout << IM(5) << "increment bccounter" << endl;
|
||||||
if(dim == 3) bccounter++;
|
if(dim == 3) bccounter++;
|
||||||
cout << "bounding-box = " << pmin << "-" << pmax << endl;
|
cout << IM(5) << "bounding-box = " << pmin << "-" << pmax << endl;
|
||||||
cout << "Created " << bccounter << " boundaries." << endl;
|
cout << IM(5) << "Created " << bccounter << " boundaries." << endl;
|
||||||
for(int i=0; i<bccounter; i++){
|
for(int i=0; i<bccounter; i++){
|
||||||
cout << mesh.GetBCName(i) << endl;
|
cout << IM(5) << mesh.GetBCName(i) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +444,7 @@ namespace netgen
|
|||||||
|
|
||||||
if ( ext == ".mesh2d" )
|
if ( ext == ".mesh2d" )
|
||||||
{
|
{
|
||||||
cout << "Reading FEPP2D Mesh" << endl;
|
cout << IM(3) << "Reading FEPP2D Mesh" << endl;
|
||||||
|
|
||||||
char buf[100];
|
char buf[100];
|
||||||
int np, ne, nseg, i, j;
|
int np, ne, nseg, i, j;
|
||||||
@ -480,7 +485,7 @@ namespace netgen
|
|||||||
|
|
||||||
else if ( ext == ".mesh" )
|
else if ( ext == ".mesh" )
|
||||||
{
|
{
|
||||||
cout << "Reading Neutral Format" << endl;
|
cout << IM(3) << "Reading Neutral Format" << endl;
|
||||||
|
|
||||||
int np, ne, nse, i, j;
|
int np, ne, nse, i, j;
|
||||||
|
|
||||||
@ -538,11 +543,11 @@ namespace netgen
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
in >> buf;
|
in >> buf;
|
||||||
cout << "buf = " << buf << endl;
|
cout << IM(5) << "buf = " << buf << endl;
|
||||||
if (strcmp (buf, "points") == 0)
|
if (strcmp (buf, "points") == 0)
|
||||||
{
|
{
|
||||||
in >> np;
|
in >> np;
|
||||||
cout << "np = " << np << endl;
|
cout << IM(5) << "np = " << np << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (in.good());
|
while (in.good());
|
||||||
@ -556,7 +561,7 @@ namespace netgen
|
|||||||
|
|
||||||
auto pktfile = filename;
|
auto pktfile = filename;
|
||||||
pktfile.replace_extension("pkt");
|
pktfile.replace_extension("pkt");
|
||||||
cout << "pktfile = " << pktfile << endl;
|
cout << IM(3) << "pktfile = " << pktfile << endl;
|
||||||
|
|
||||||
int np, nse, i;
|
int np, nse, i;
|
||||||
int bcprop;
|
int bcprop;
|
||||||
@ -597,7 +602,7 @@ namespace netgen
|
|||||||
p3++;
|
p3++;
|
||||||
if (p1 < 1 || p1 > np || p2 < 1 || p2 > np || p3 < 1 || p3 > np)
|
if (p1 < 1 || p1 > np || p2 < 1 || p2 > np || p3 < 1 || p3 > np)
|
||||||
{
|
{
|
||||||
cout << "p1 = " << p1 << " p2 = " << p2 << " p3 = " << p3 << endl;
|
cout << IM(3) << "p1 = " << p1 << " p2 = " << p2 << " p3 = " << p3 << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 110354) Swap (p2, p3);
|
if (i > 110354) Swap (p2, p3);
|
||||||
@ -627,7 +632,7 @@ namespace netgen
|
|||||||
ifstream incyl ("ngusers/guenter/cylinder.surf");
|
ifstream incyl ("ngusers/guenter/cylinder.surf");
|
||||||
int npcyl, nsecyl;
|
int npcyl, nsecyl;
|
||||||
incyl >> npcyl;
|
incyl >> npcyl;
|
||||||
cout << "npcyl = " << npcyl << endl;
|
cout << IM(3) << "npcyl = " << npcyl << endl;
|
||||||
for (i = 1; i <= npcyl; i++)
|
for (i = 1; i <= npcyl; i++)
|
||||||
{
|
{
|
||||||
Point3d p(0,0,0);
|
Point3d p(0,0,0);
|
||||||
@ -635,7 +640,7 @@ namespace netgen
|
|||||||
mesh.AddPoint (p);
|
mesh.AddPoint (p);
|
||||||
}
|
}
|
||||||
incyl >> nsecyl;
|
incyl >> nsecyl;
|
||||||
cout << "nsecyl = " << nsecyl << endl;
|
cout << IM(3) << "nsecyl = " << nsecyl << endl;
|
||||||
for (i = 1; i <= nsecyl; i++)
|
for (i = 1; i <= nsecyl; i++)
|
||||||
{
|
{
|
||||||
incyl >> p1 >> p2 >> p3;
|
incyl >> p1 >> p2 >> p3;
|
||||||
|
Loading…
Reference in New Issue
Block a user