mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-13 06:30:34 +05:00
Forced linking of 2d-library to interface-library (this should solve the problem with SplineGeometryRegister if building without GUI)
This commit is contained in:
parent
7e062372d4
commit
ebc6506f3e
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
#include <csg.hpp>
|
#include <csg.hpp>
|
||||||
|
#include <geometry2d.hpp>
|
||||||
|
|
||||||
#ifdef SOCKETS
|
#ifdef SOCKETS
|
||||||
#include "../sockets/sockets.hpp"
|
#include "../sockets/sockets.hpp"
|
||||||
@ -17,6 +17,9 @@
|
|||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
DLL_HEADER MeshingParameters mparam;
|
DLL_HEADER MeshingParameters mparam;
|
||||||
|
|
||||||
|
/** Force linking of geom2d library (for SplineGeometryRegister)**/
|
||||||
|
SplineGeometry2d dummy_2dgeom;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::thread meshingthread;
|
static std::thread meshingthread;
|
||||||
@ -69,8 +72,6 @@ using namespace netgen;
|
|||||||
void Ng_LoadGeometry (const char * filename)
|
void Ng_LoadGeometry (const char * filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
cout << endl << "LOAD GEOMETRY FROM FILE " << filename << endl;
|
|
||||||
|
|
||||||
// he: if filename is empty, return
|
// he: if filename is empty, return
|
||||||
// can be used to reset geometry
|
// can be used to reset geometry
|
||||||
if (!filename || strcmp(filename,"")==0)
|
if (!filename || strcmp(filename,"")==0)
|
||||||
@ -90,7 +91,6 @@ void Ng_LoadGeometry (const char * filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (id == 0)
|
// if (id == 0)
|
||||||
cerr << "cannot load geometry '" << filename << "'" << ", id = " << id << endl;
|
cerr << "cannot load geometry '" << filename << "'" << ", id = " << id << endl;
|
||||||
}
|
}
|
||||||
@ -121,28 +121,18 @@ void Ng_LoadMeshFromStream ( istream & input )
|
|||||||
|
|
||||||
void Ng_LoadMesh (const char * filename)
|
void Ng_LoadMesh (const char * filename)
|
||||||
{
|
{
|
||||||
|
#ifdef PARALLEL
|
||||||
|
MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
|
||||||
|
MPI_Comm_rank(MPI_COMM_WORLD, &id);
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
ifstream infile(filename);
|
ifstream infile(filename);
|
||||||
if(!infile.good())
|
if(!infile.good())
|
||||||
throw NgException(string("Error opening file ") + filename);
|
throw NgException(string("Error opening file ") + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
istream * infile;
|
|
||||||
char* buf; // for distributing geometry!
|
|
||||||
int strs;
|
|
||||||
|
|
||||||
#ifdef PARALLEL
|
|
||||||
MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
|
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD, &id);
|
|
||||||
|
|
||||||
if (id == 0)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
if ( string(filename).find(".vol") == string::npos )
|
if ( string(filename).find(".vol") == string::npos )
|
||||||
/*
|
|
||||||
if ( (strlen (filename) > 4) &&
|
|
||||||
strcmp (filename + (strlen (filename)-4), ".vol") != 0 )
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
#ifdef PARALLEL
|
#ifdef PARALLEL
|
||||||
if(ntasks>1)
|
if(ntasks>1)
|
||||||
@ -150,30 +140,36 @@ void Ng_LoadMesh (const char * filename)
|
|||||||
#endif
|
#endif
|
||||||
mesh.reset (new Mesh());
|
mesh.reset (new Mesh());
|
||||||
ReadFile(*mesh,filename);
|
ReadFile(*mesh,filename);
|
||||||
|
|
||||||
//mesh->SetGlobalH (mparam.maxh);
|
//mesh->SetGlobalH (mparam.maxh);
|
||||||
//mesh->CalcLocalH();
|
//mesh->CalcLocalH();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fn(filename);
|
istream * infile;
|
||||||
|
char* buf; // for distributing geometry!
|
||||||
|
int strs;
|
||||||
|
|
||||||
|
#ifdef PARALLEL
|
||||||
|
if( id == 0) {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
string fn(filename);
|
||||||
if (fn.substr (fn.length()-3, 3) == ".gz")
|
if (fn.substr (fn.length()-3, 3) == ".gz")
|
||||||
infile = new igzstream (filename);
|
infile = new igzstream (filename);
|
||||||
else
|
else
|
||||||
infile = new ifstream (filename);
|
infile = new ifstream (filename);
|
||||||
|
|
||||||
// Ng_LoadMeshFromStream(*infile);
|
|
||||||
mesh.reset (new Mesh());
|
mesh.reset (new Mesh());
|
||||||
mesh -> Load(*infile);
|
mesh -> Load(*infile);
|
||||||
|
|
||||||
|
// make string from rest of file (for geometry info!)
|
||||||
|
if(!ng_geometry) {
|
||||||
stringstream geom_part;
|
stringstream geom_part;
|
||||||
geom_part << infile->rdbuf();
|
geom_part << infile->rdbuf();
|
||||||
string geom_part_string = geom_part.str();
|
string geom_part_string = geom_part.str();
|
||||||
strs = geom_part_string.size();
|
strs = geom_part_string.size();
|
||||||
buf = new char[strs];
|
buf = new char[strs];
|
||||||
memcpy(buf, geom_part_string.c_str(), strs*sizeof(char));
|
memcpy(buf, geom_part_string.c_str(), strs*sizeof(char));
|
||||||
|
}
|
||||||
delete infile;
|
delete infile;
|
||||||
|
|
||||||
#ifdef PARALLEL
|
#ifdef PARALLEL
|
||||||
@ -238,25 +234,23 @@ void Ng_LoadMesh (const char * filename)
|
|||||||
|
|
||||||
mesh -> Distribute(volume_weights, surface_weights, segment_weights);
|
mesh -> Distribute(volume_weights, surface_weights, segment_weights);
|
||||||
}
|
}
|
||||||
}
|
} // ntasks>1 end
|
||||||
}
|
} // id==0 end
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
mesh.reset (new Mesh());
|
mesh.reset (new Mesh());
|
||||||
// vssolution.SetMesh(mesh);
|
|
||||||
// vsmesh.SetMesh(mesh);
|
|
||||||
SetGlobalMesh (mesh);
|
SetGlobalMesh (mesh);
|
||||||
mesh->SendRecvMesh();
|
mesh->SendRecvMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ntasks>1) {
|
if(!ng_geometry && ntasks>1) {
|
||||||
/** Scatter the geometry-string **/
|
/** Scatter the geometry-string **/
|
||||||
MPI_Bcast(&strs, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
MPI_Bcast(&strs, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||||
if(id!=0)
|
if(id!=0) buf = new char[strs];
|
||||||
buf = new char[strs];
|
|
||||||
MPI_Bcast(buf, strs, MPI_CHAR, 0, MPI_COMM_WORLD);
|
MPI_Bcast(buf, strs, MPI_CHAR, 0, MPI_COMM_WORLD);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(!ng_geometry) {
|
||||||
infile = new istringstream(string((const char*)buf, (size_t)strs));
|
infile = new istringstream(string((const char*)buf, (size_t)strs));
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
for (int i = 0; i < geometryregister.Size(); i++)
|
for (int i = 0; i < geometryregister.Size(); i++)
|
||||||
@ -269,14 +263,16 @@ void Ng_LoadMesh (const char * filename)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ng_geometry)
|
}
|
||||||
ng_geometry = make_shared<NetgenGeometry>();
|
/** Dummy Geometry if we still could not find any geometry info! **/
|
||||||
|
// if (!ng_geometry)
|
||||||
|
// ng_geometry = make_shared<NetgenGeometry>();
|
||||||
|
if(ng_geometry)
|
||||||
mesh->SetGeometry(ng_geometry);
|
mesh->SetGeometry(ng_geometry);
|
||||||
delete infile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ng_LoadMeshFromString (const char * mesh_as_string)
|
void Ng_LoadMeshFromString (const char * mesh_as_string)
|
||||||
{
|
{
|
||||||
istringstream instream(mesh_as_string);
|
istringstream instream(mesh_as_string);
|
||||||
Ng_LoadMeshFromStream(instream);
|
Ng_LoadMeshFromStream(instream);
|
||||||
}
|
}
|
||||||
|
@ -5857,8 +5857,6 @@ namespace netgen
|
|||||||
if (!GetGeometry())
|
if (!GetGeometry())
|
||||||
throw NgException ("don't have a geometry for mesh curving");
|
throw NgException ("don't have a geometry for mesh curving");
|
||||||
|
|
||||||
cout << "Build Curved Elements, order = " << aorder << endl;
|
|
||||||
|
|
||||||
GetCurvedElements().BuildCurvedElements (&GetGeometry()->GetRefinement(), aorder, false);
|
GetCurvedElements().BuildCurvedElements (&GetGeometry()->GetRefinement(), aorder, false);
|
||||||
|
|
||||||
for (SegmentIndex seg = 0; seg < GetNSeg(); seg++)
|
for (SegmentIndex seg = 0; seg < GetNSeg(); seg++)
|
||||||
|
Loading…
Reference in New Issue
Block a user