mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
save export filetype
This commit is contained in:
parent
c5800d02a7
commit
c4c3773610
@ -1,4 +1,4 @@
|
||||
AC_INIT([netgen],[4.9.11],[],[])
|
||||
AC_INIT([netgen],[4.9.12-dev],[],[])
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
@ -443,6 +443,7 @@ namespace netgen
|
||||
StoreShortEdge (refedges, refedgesinv,
|
||||
edgepoints, curvelength, layer, mesh);
|
||||
|
||||
|
||||
for(int i = 0; i < refedges.Size(); i++)
|
||||
{
|
||||
refedges[i].surfnr1 = geometry.GetSurfaceClassRepresentant(refedges[i].surfnr1);
|
||||
@ -482,6 +483,23 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// not available ...
|
||||
for (int i = 0; i < refedges.Size(); i++)
|
||||
{
|
||||
EdgeDescriptor ed;
|
||||
ed.SetSurfNr(0, refedges[i].surfnr1);
|
||||
ed.SetSurfNr(1, refedges[i].surfnr2);
|
||||
int hnr = mesh.AddEdgeDescriptor(ed);
|
||||
if (hnr != refedges[i].edgenr)
|
||||
{
|
||||
cerr << "edgedescriptor index wrong: new : " << hnr << " old = " << refedges[i].edgenr << endl;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// for(int i=0; i<hsp.Size(); i++)
|
||||
// {
|
||||
// (*testout) << "pos2 hsp["<<i<<"] ... " << specpoints[hsp[i]].p << endl;
|
||||
|
@ -393,9 +393,9 @@ namespace netgen
|
||||
if (surfs[l] == fd.SurfNr())
|
||||
{
|
||||
if (geom.singfaces[j]->GetDomainNr() == fd.DomainIn())
|
||||
fd.domin_singular = 1;
|
||||
fd.SetDomainInSingular (1);
|
||||
if (geom.singfaces[j]->GetDomainNr() == fd.DomainOut())
|
||||
fd.domout_singular = 1;
|
||||
fd.SetDomainOutSingular (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,32 +15,37 @@ namespace netgen
|
||||
#include "writeuser.hpp"
|
||||
|
||||
|
||||
void RegisterUserFormats (Array<const char*> & names)
|
||||
void RegisterUserFormats (Array<const char*> & names,
|
||||
Array<const char*> & extensions)
|
||||
|
||||
{
|
||||
const char *types[] =
|
||||
{
|
||||
"Neutral Format",
|
||||
"Surface Mesh Format" ,
|
||||
"DIFFPACK Format",
|
||||
"TecPlot Format",
|
||||
"Tochnog Format",
|
||||
"Abaqus Format",
|
||||
"Fluent Format",
|
||||
"Permas Format",
|
||||
"FEAP Format",
|
||||
"Elmer Format",
|
||||
"STL Format",
|
||||
"VRML Format",
|
||||
"Gmsh Format",
|
||||
"Gmsh2 Format",
|
||||
"JCMwave Format",
|
||||
"TET Format",
|
||||
"Neutral Format", ".mesh",
|
||||
"Surface Mesh Format", ".mesh" ,
|
||||
"DIFFPACK Format", ".mesh",
|
||||
"TecPlot Format", ".mesh",
|
||||
"Tochnog Format", ".mesh",
|
||||
"Abaqus Format", ".mesh",
|
||||
"Fluent Format", ".mesh",
|
||||
"Permas Format", ".mesh",
|
||||
"FEAP Format", ".mesh",
|
||||
"Elmer Format", "*",
|
||||
"STL Format", ".stl",
|
||||
"VRML Format", ".*",
|
||||
"Gmsh Format", ".gmsh",
|
||||
"Gmsh2 Format", ".gmsh2",
|
||||
"JCMwave Format", ".jcm",
|
||||
"TET Format", ".tet",
|
||||
// { "Chemnitz Format" },
|
||||
0
|
||||
};
|
||||
|
||||
for (int i = 0; types[i]; i++)
|
||||
names.Append (types[i]);
|
||||
for (int i = 0; types[2*i]; i++)
|
||||
{
|
||||
names.Append (types[2*i]);
|
||||
extensions.Append (types[2*i+1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -135,7 +135,9 @@ void WriteDolfinFormat (const Mesh & mesh,
|
||||
const string & filename);
|
||||
|
||||
|
||||
extern void RegisterUserFormats (Array<const char*> & names);
|
||||
extern void RegisterUserFormats (Array<const char*> & names,
|
||||
Array<const char*> & extensions);
|
||||
|
||||
|
||||
extern bool WriteUserFormat (const string & format,
|
||||
const Mesh & mesh,
|
||||
|
@ -147,7 +147,7 @@ namespace netgen
|
||||
for(int i = 1; i <= numentries; i++)
|
||||
{
|
||||
int bcnum;
|
||||
double col_red, col_green, col_blue;
|
||||
// double col_red, col_green, col_blue;
|
||||
|
||||
ocf >> bcnum;
|
||||
// Boundary condition number 0 is reserved for
|
||||
|
@ -1668,21 +1668,21 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
const FaceDescriptor & fd = mesh.GetFaceDescriptor (el.GetIndex());
|
||||
|
||||
int domnr = 0;
|
||||
if (fd.domin_singular * levels < act_ref && fd.domout_singular * levels < act_ref)
|
||||
if (fd.DomainInSingular() * levels < act_ref && fd.DomainOutSingular() * levels < act_ref)
|
||||
{ domnr=0; continue;}
|
||||
|
||||
if (fd.domin_singular * levels >= act_ref)
|
||||
if (fd.DomainInSingular() * levels >= act_ref)
|
||||
{
|
||||
domnr = fd.DomainIn();
|
||||
sing = 1;
|
||||
}
|
||||
if (fd.domout_singular * levels >= act_ref)
|
||||
if (fd.DomainOutSingular() * levels >= act_ref)
|
||||
{
|
||||
domnr = fd.DomainOut();
|
||||
sing = 1;
|
||||
}
|
||||
if (fd.domin_singular * levels >= act_ref
|
||||
&& fd.domout_singular * levels >= act_ref)
|
||||
if (fd.DomainInSingular() * levels >= act_ref
|
||||
&& fd.DomainOutSingular() * levels >= act_ref)
|
||||
{
|
||||
domnr = -1;
|
||||
sing = 1;
|
||||
|
@ -7,9 +7,9 @@ namespace netgen
|
||||
|
||||
Mesh :: Mesh ()
|
||||
{
|
||||
volelements.SetName ("vol elements");
|
||||
surfelements.SetName ("surf elements");
|
||||
points.SetName ("meshpoints");
|
||||
// volelements.SetName ("vol elements");
|
||||
// surfelements.SetName ("surf elements");
|
||||
// points.SetName ("meshpoints");
|
||||
|
||||
boundaryedges = NULL;
|
||||
surfelementht = NULL;
|
||||
|
@ -23,13 +23,15 @@ class HPRefElement;
|
||||
class Mesh
|
||||
{
|
||||
public:
|
||||
typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
typedef MoveableArray<Element> T_VOLELEMENTS;
|
||||
typedef MoveableArray<Element2d> T_SURFELEMENTS;
|
||||
typedef ::netgen::T_POINTS T_POINTS;
|
||||
|
||||
// typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
// typedef MoveableArray<Element> T_VOLELEMENTS;
|
||||
// typedef MoveableArray<Element2d> T_SURFELEMENTS;
|
||||
|
||||
// typedef Array<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
// typedef Array<Element> T_VOLELEMENTS;
|
||||
// typedef Array<Element2d> T_SURFELEMENTS;
|
||||
typedef Array<Element> T_VOLELEMENTS;
|
||||
typedef Array<Element2d> T_SURFELEMENTS;
|
||||
|
||||
|
||||
private:
|
||||
@ -82,10 +84,18 @@ private:
|
||||
*/
|
||||
Array<FaceDescriptor> facedecoding;
|
||||
|
||||
|
||||
/**
|
||||
the edge-index of the line element maps into
|
||||
this table.
|
||||
*/
|
||||
Array<EdgeDescriptor> edgedecoding;
|
||||
|
||||
/// sub-domain materials
|
||||
Array<char*> materials;
|
||||
|
||||
Array<string*, 0> bcnames;
|
||||
/// labels for boundary conditions
|
||||
Array<string*> bcnames;
|
||||
|
||||
/// Periodic surface, close surface, etc. identifications
|
||||
Identifications * ident;
|
||||
@ -565,6 +575,8 @@ public:
|
||||
int AddFaceDescriptor(const FaceDescriptor& fd)
|
||||
{ return facedecoding.Append(fd); }
|
||||
|
||||
int AddEdgeDescriptor(const EdgeDescriptor & fd)
|
||||
{ return edgedecoding.Append(fd) - 1; }
|
||||
|
||||
///
|
||||
void SetMaterial (int domnr, const char * mat);
|
||||
@ -591,6 +603,10 @@ public:
|
||||
const FaceDescriptor & GetFaceDescriptor (int i) const
|
||||
{ return facedecoding.Get(i); }
|
||||
|
||||
const EdgeDescriptor & GetEdgeDescriptor (int i) const
|
||||
{ return edgedecoding[i]; }
|
||||
|
||||
|
||||
///
|
||||
FaceDescriptor & GetFaceDescriptor (int i)
|
||||
{ return facedecoding.Elem(i); }
|
||||
|
@ -399,11 +399,16 @@ namespace netgen
|
||||
|
||||
|
||||
debugflag =
|
||||
debugparam.haltsegment &&
|
||||
( ((debugparam.haltsegmentp1 == gpi1) && (debugparam.haltsegmentp2 == gpi2)) ||
|
||||
((debugparam.haltsegmentp1 == gpi2) && (debugparam.haltsegmentp2 == gpi1))) ||
|
||||
debugparam.haltnode &&
|
||||
( (debugparam.haltsegmentp1 == gpi1) || (debugparam.haltsegmentp2 == gpi1));
|
||||
(
|
||||
debugparam.haltsegment &&
|
||||
( ((debugparam.haltsegmentp1 == gpi1) && (debugparam.haltsegmentp2 == gpi2)) ||
|
||||
((debugparam.haltsegmentp1 == gpi2) && (debugparam.haltsegmentp2 == gpi1)))
|
||||
)
|
||||
||
|
||||
(
|
||||
debugparam.haltnode &&
|
||||
( (debugparam.haltsegmentp1 == gpi1) || (debugparam.haltsegmentp2 == gpi1))
|
||||
);
|
||||
|
||||
|
||||
if (debugparam.haltface && debugparam.haltfacenr == facenr)
|
||||
|
@ -2270,9 +2270,9 @@ namespace netgen
|
||||
|
||||
FaceDescriptor :: FaceDescriptor(const FaceDescriptor& other)
|
||||
: surfnr(other.surfnr), domin(other.domin), domout(other.domout),
|
||||
tlosurf(other.tlosurf), bcprop(other.bcprop), bcname(other.bcname),
|
||||
domin_singular(other.domin_singular), domout_singular(other.domout_singular),
|
||||
surfcolour(other.surfcolour)
|
||||
tlosurf(other.tlosurf), bcprop(other.bcprop),
|
||||
surfcolour(other.surfcolour), bcname(other.bcname),
|
||||
domin_singular(other.domin_singular), domout_singular(other.domout_singular)
|
||||
{
|
||||
firstelement = -1;
|
||||
}
|
||||
@ -2337,14 +2337,14 @@ namespace netgen
|
||||
|
||||
ostream & operator<<(ostream & s, const FaceDescriptor & fd)
|
||||
{
|
||||
s << "surfnr = " << fd.surfnr
|
||||
<< ", domin = " << fd.domin
|
||||
<< ", domout = " << fd.domout
|
||||
<< ", tlosurf = " << fd.tlosurf
|
||||
<< ", bcprop = " << fd.bcprop
|
||||
<< ", domin_sing = " << fd.domin_singular
|
||||
<< ", domout_sing = " << fd.domout_singular
|
||||
<< ", colour = " << fd.surfcolour;
|
||||
s << "surfnr = " << fd.SurfNr()
|
||||
<< ", domin = " << fd.DomainIn()
|
||||
<< ", domout = " << fd.DomainOut()
|
||||
<< ", tlosurf = " << fd.TLOSurface()
|
||||
<< ", bcprop = " << fd.BCProperty()
|
||||
<< ", domin_sing = " << fd.DomainInSingular()
|
||||
<< ", domout_sing = " << fd.DomainOutSingular()
|
||||
<< ", colour = " << fd.SurfColour();
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -280,8 +280,8 @@ ostream & operator<<(ostream & s, const MeshPoint & pt);
|
||||
|
||||
|
||||
|
||||
typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
// typedef Array<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
// typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
typedef Array<MeshPoint,PointIndex::BASE> T_POINTS;
|
||||
|
||||
|
||||
class Element2d;
|
||||
@ -422,7 +422,7 @@ public:
|
||||
|
||||
bool BadElement() const { return badel; }
|
||||
|
||||
friend ostream & operator<<(ostream & s, const Element2d & el);
|
||||
// friend ostream & operator<<(ostream & s, const Element2d & el);
|
||||
friend class Mesh;
|
||||
|
||||
|
||||
@ -785,15 +785,10 @@ public:
|
||||
~Segment()
|
||||
{ ; }
|
||||
|
||||
friend ostream & operator<<(ostream & s, const Segment & seg);
|
||||
// friend ostream & operator<<(ostream & s, const Segment & seg);
|
||||
|
||||
PointIndex pnums[3]; // p1, p2, pmid
|
||||
|
||||
/// point index 1
|
||||
// PointIndex p1;
|
||||
/// point index 2
|
||||
// PointIndex p2;
|
||||
/// edge nr
|
||||
int edgenr;
|
||||
///
|
||||
double singedge_left;
|
||||
@ -875,8 +870,7 @@ public:
|
||||
|
||||
|
||||
// class Surface;
|
||||
class FaceDescriptor;
|
||||
ostream & operator<< (ostream & s, const FaceDescriptor & fd);
|
||||
// class FaceDescriptor;
|
||||
|
||||
///
|
||||
class FaceDescriptor
|
||||
@ -902,10 +896,9 @@ class FaceDescriptor
|
||||
/// root of linked list
|
||||
SurfaceElementIndex firstelement;
|
||||
|
||||
public:
|
||||
///
|
||||
double domin_singular;
|
||||
double domout_singular;
|
||||
|
||||
public:
|
||||
FaceDescriptor();
|
||||
FaceDescriptor(int surfnri, int domini, int domouti, int tlosurfi);
|
||||
@ -920,6 +913,11 @@ public:
|
||||
int DomainOut () const { return domout; }
|
||||
int TLOSurface () const { return tlosurf; }
|
||||
int BCProperty () const { return bcprop; }
|
||||
|
||||
|
||||
double DomainInSingular() const { return domin_singular; }
|
||||
double DomainOutSingular() const { return domout_singular; }
|
||||
|
||||
// Philippose - 06/07/2009
|
||||
// Get Surface colour
|
||||
Vec3d SurfColour () const { return surfcolour; }
|
||||
@ -935,12 +933,32 @@ public:
|
||||
// Set the surface colour
|
||||
void SetSurfColour (Vec3d colour) { surfcolour = colour; }
|
||||
|
||||
friend ostream & operator<<(ostream & s, const FaceDescriptor & fd);
|
||||
void SetDomainInSingular (double v) { domin_singular = v; }
|
||||
void SetDomainOutSingular (double v) { domout_singular = v; }
|
||||
|
||||
|
||||
// friend ostream & operator<<(ostream & s, const FaceDescriptor & fd);
|
||||
friend class Mesh;
|
||||
};
|
||||
|
||||
ostream & operator<< (ostream & s, const FaceDescriptor & fd);
|
||||
|
||||
|
||||
class EdgeDescriptor
|
||||
{
|
||||
int tlosurf;
|
||||
int surfnr[2];
|
||||
public:
|
||||
EdgeDescriptor ()
|
||||
: tlosurf(-1)
|
||||
{ surfnr[0] = surfnr[1] = -1; }
|
||||
|
||||
int SurfNr (int i) const { return surfnr[i]; }
|
||||
void SetSurfNr (int i, int nr) { surfnr[i] = nr; }
|
||||
|
||||
int TLOSurface() const { return tlosurf; }
|
||||
void SetTLOSurface (int nr) { tlosurf = nr; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -93,9 +93,6 @@ menu .ngmenu.file
|
||||
lappend types {"ACIS Geometry" {.sat} }
|
||||
}
|
||||
|
||||
|
||||
|
||||
# set file [tk_getSaveFile -filetypes $types -defaultextension ".stl" -initialdir $dirname -initialfile $basefilename ]
|
||||
set file [tk_getSaveFile -filetypes $types -initialdir $dirname -initialfile $basefilename ]
|
||||
if {$file != ""} {
|
||||
Ng_SaveGeometry $file
|
||||
@ -234,13 +231,23 @@ loadmeshinifile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.ngmenu.file add command -label "Export Mesh..." \
|
||||
-command {
|
||||
|
||||
# global meshexportformats
|
||||
foreach exportformat $meshexportformats {
|
||||
if { [lindex $exportformat 0] == $exportfiletype } {
|
||||
set extension [lindex $exportformat 1]
|
||||
}
|
||||
}
|
||||
|
||||
if { $exportfiletype == "Elmer Format" } {
|
||||
set file [tk_chooseDirectory]
|
||||
} else {
|
||||
set file [tk_getSaveFile]
|
||||
set file [tk_getSaveFile -filetypes "{ \"$exportfiletype\" {$extension} }" ]
|
||||
}
|
||||
|
||||
if {$file != ""} {
|
||||
Ng_ExportMesh $file $exportfiletype
|
||||
}
|
||||
|
@ -269,16 +269,22 @@ int main(int argc, char ** argv)
|
||||
|
||||
// lookup user file formats and insert into format list:
|
||||
Array<const char*> userformats;
|
||||
RegisterUserFormats (userformats);
|
||||
Array<const char*> extensions;
|
||||
RegisterUserFormats (userformats, extensions);
|
||||
|
||||
ostringstream fstr;
|
||||
for (int i = 1; i <= userformats.Size(); i++)
|
||||
fstr << ".ngmenu.file.filetype add radio -label \""
|
||||
<< userformats.Get(i) << "\" -variable exportfiletype\n";
|
||||
|
||||
tcl_const char * exportft = Tcl_GetVar (myinterp, "exportfiletype", 0);
|
||||
for (int i = 1; i <= userformats.Size(); i++)
|
||||
{
|
||||
fstr << ".ngmenu.file.filetype add radio -label \""
|
||||
<< userformats.Get(i) << "\" -variable exportfiletype\n";
|
||||
fstr << "lappend meshexportformats { {" << userformats.Get(i) << "} {" << extensions.Get(i) << "} }\n";
|
||||
}
|
||||
|
||||
Tcl_Eval (myinterp, (char*)fstr.str().c_str());
|
||||
Tcl_SetVar (myinterp, "exportfiletype", "Neutral Format", 0);
|
||||
// Tcl_SetVar (myinterp, "exportfiletype", "Neutral Format", 0);
|
||||
Tcl_SetVar (myinterp, "exportfiletype", exportft, 0);
|
||||
|
||||
|
||||
// For adding an application, parse the file here,
|
||||
|
@ -389,6 +389,7 @@ proc saveoptions { } {
|
||||
set datei [open $file w]
|
||||
puts $datei "dirname ${dirname}"
|
||||
puts $datei "loadgeomtypevar \"${loadgeomtypevar}\""
|
||||
puts $datei "exportfiletype \"${exportfiletype}\""
|
||||
puts $datei "meshoptions.fineness ${meshoptions.fineness}"
|
||||
puts $datei "meshoptions.firststep ${meshoptions.firststep}"
|
||||
puts $datei "meshoptions.laststep ${meshoptions.laststep}"
|
||||
|
Loading…
Reference in New Issue
Block a user