save export filetype

This commit is contained in:
Joachim Schoeberl 2009-09-22 07:12:00 +00:00
parent c5800d02a7
commit c4c3773610
15 changed files with 160 additions and 82 deletions

View File

@ -1,4 +1,4 @@
AC_INIT([netgen],[4.9.11],[],[]) AC_INIT([netgen],[4.9.12-dev],[],[])
AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])

View File

@ -443,6 +443,7 @@ namespace netgen
StoreShortEdge (refedges, refedgesinv, StoreShortEdge (refedges, refedgesinv,
edgepoints, curvelength, layer, mesh); edgepoints, curvelength, layer, mesh);
for(int i = 0; i < refedges.Size(); i++) for(int i = 0; i < refedges.Size(); i++)
{ {
refedges[i].surfnr1 = geometry.GetSurfaceClassRepresentant(refedges[i].surfnr1); 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++) // for(int i=0; i<hsp.Size(); i++)
// { // {
// (*testout) << "pos2 hsp["<<i<<"] ... " << specpoints[hsp[i]].p << endl; // (*testout) << "pos2 hsp["<<i<<"] ... " << specpoints[hsp[i]].p << endl;

View File

@ -393,9 +393,9 @@ namespace netgen
if (surfs[l] == fd.SurfNr()) if (surfs[l] == fd.SurfNr())
{ {
if (geom.singfaces[j]->GetDomainNr() == fd.DomainIn()) if (geom.singfaces[j]->GetDomainNr() == fd.DomainIn())
fd.domin_singular = 1; fd.SetDomainInSingular (1);
if (geom.singfaces[j]->GetDomainNr() == fd.DomainOut()) if (geom.singfaces[j]->GetDomainNr() == fd.DomainOut())
fd.domout_singular = 1; fd.SetDomainOutSingular (1);
} }
} }
} }

View File

@ -15,32 +15,37 @@ namespace netgen
#include "writeuser.hpp" #include "writeuser.hpp"
void RegisterUserFormats (Array<const char*> & names) void RegisterUserFormats (Array<const char*> & names,
Array<const char*> & extensions)
{ {
const char *types[] = const char *types[] =
{ {
"Neutral Format", "Neutral Format", ".mesh",
"Surface Mesh Format" , "Surface Mesh Format", ".mesh" ,
"DIFFPACK Format", "DIFFPACK Format", ".mesh",
"TecPlot Format", "TecPlot Format", ".mesh",
"Tochnog Format", "Tochnog Format", ".mesh",
"Abaqus Format", "Abaqus Format", ".mesh",
"Fluent Format", "Fluent Format", ".mesh",
"Permas Format", "Permas Format", ".mesh",
"FEAP Format", "FEAP Format", ".mesh",
"Elmer Format", "Elmer Format", "*",
"STL Format", "STL Format", ".stl",
"VRML Format", "VRML Format", ".*",
"Gmsh Format", "Gmsh Format", ".gmsh",
"Gmsh2 Format", "Gmsh2 Format", ".gmsh2",
"JCMwave Format", "JCMwave Format", ".jcm",
"TET Format", "TET Format", ".tet",
// { "Chemnitz Format" }, // { "Chemnitz Format" },
0 0
}; };
for (int i = 0; types[i]; i++) for (int i = 0; types[2*i]; i++)
names.Append (types[i]); {
names.Append (types[2*i]);
extensions.Append (types[2*i+1]);
}
} }

View File

@ -135,7 +135,9 @@ void WriteDolfinFormat (const Mesh & mesh,
const string & filename); 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, extern bool WriteUserFormat (const string & format,
const Mesh & mesh, const Mesh & mesh,

View File

@ -147,7 +147,7 @@ namespace netgen
for(int i = 1; i <= numentries; i++) for(int i = 1; i <= numentries; i++)
{ {
int bcnum; int bcnum;
double col_red, col_green, col_blue; // double col_red, col_green, col_blue;
ocf >> bcnum; ocf >> bcnum;
// Boundary condition number 0 is reserved for // Boundary condition number 0 is reserved for

View File

@ -1668,21 +1668,21 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
const FaceDescriptor & fd = mesh.GetFaceDescriptor (el.GetIndex()); const FaceDescriptor & fd = mesh.GetFaceDescriptor (el.GetIndex());
int domnr = 0; 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;} { domnr=0; continue;}
if (fd.domin_singular * levels >= act_ref) if (fd.DomainInSingular() * levels >= act_ref)
{ {
domnr = fd.DomainIn(); domnr = fd.DomainIn();
sing = 1; sing = 1;
} }
if (fd.domout_singular * levels >= act_ref) if (fd.DomainOutSingular() * levels >= act_ref)
{ {
domnr = fd.DomainOut(); domnr = fd.DomainOut();
sing = 1; sing = 1;
} }
if (fd.domin_singular * levels >= act_ref if (fd.DomainInSingular() * levels >= act_ref
&& fd.domout_singular * levels >= act_ref) && fd.DomainOutSingular() * levels >= act_ref)
{ {
domnr = -1; domnr = -1;
sing = 1; sing = 1;

View File

@ -7,9 +7,9 @@ namespace netgen
Mesh :: Mesh () Mesh :: Mesh ()
{ {
volelements.SetName ("vol elements"); // volelements.SetName ("vol elements");
surfelements.SetName ("surf elements"); // surfelements.SetName ("surf elements");
points.SetName ("meshpoints"); // points.SetName ("meshpoints");
boundaryedges = NULL; boundaryedges = NULL;
surfelementht = NULL; surfelementht = NULL;

View File

@ -23,13 +23,15 @@ class HPRefElement;
class Mesh class Mesh
{ {
public: public:
typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS; typedef ::netgen::T_POINTS T_POINTS;
typedef MoveableArray<Element> T_VOLELEMENTS;
typedef MoveableArray<Element2d> T_SURFELEMENTS; // 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<MeshPoint,PointIndex::BASE> T_POINTS;
// typedef Array<Element> T_VOLELEMENTS; typedef Array<Element> T_VOLELEMENTS;
// typedef Array<Element2d> T_SURFELEMENTS; typedef Array<Element2d> T_SURFELEMENTS;
private: private:
@ -82,10 +84,18 @@ private:
*/ */
Array<FaceDescriptor> facedecoding; Array<FaceDescriptor> facedecoding;
/**
the edge-index of the line element maps into
this table.
*/
Array<EdgeDescriptor> edgedecoding;
/// sub-domain materials /// sub-domain materials
Array<char*> materials; Array<char*> materials;
Array<string*, 0> bcnames; /// labels for boundary conditions
Array<string*> bcnames;
/// Periodic surface, close surface, etc. identifications /// Periodic surface, close surface, etc. identifications
Identifications * ident; Identifications * ident;
@ -565,6 +575,8 @@ public:
int AddFaceDescriptor(const FaceDescriptor& fd) int AddFaceDescriptor(const FaceDescriptor& fd)
{ return facedecoding.Append(fd); } { return facedecoding.Append(fd); }
int AddEdgeDescriptor(const EdgeDescriptor & fd)
{ return edgedecoding.Append(fd) - 1; }
/// ///
void SetMaterial (int domnr, const char * mat); void SetMaterial (int domnr, const char * mat);
@ -591,6 +603,10 @@ public:
const FaceDescriptor & GetFaceDescriptor (int i) const const FaceDescriptor & GetFaceDescriptor (int i) const
{ return facedecoding.Get(i); } { return facedecoding.Get(i); }
const EdgeDescriptor & GetEdgeDescriptor (int i) const
{ return edgedecoding[i]; }
/// ///
FaceDescriptor & GetFaceDescriptor (int i) FaceDescriptor & GetFaceDescriptor (int i)
{ return facedecoding.Elem(i); } { return facedecoding.Elem(i); }

View File

@ -399,11 +399,16 @@ namespace netgen
debugflag = debugflag =
(
debugparam.haltsegment && debugparam.haltsegment &&
( ((debugparam.haltsegmentp1 == gpi1) && (debugparam.haltsegmentp2 == gpi2)) || ( ((debugparam.haltsegmentp1 == gpi1) && (debugparam.haltsegmentp2 == gpi2)) ||
((debugparam.haltsegmentp1 == gpi2) && (debugparam.haltsegmentp2 == gpi1))) || ((debugparam.haltsegmentp1 == gpi2) && (debugparam.haltsegmentp2 == gpi1)))
)
||
(
debugparam.haltnode && debugparam.haltnode &&
( (debugparam.haltsegmentp1 == gpi1) || (debugparam.haltsegmentp2 == gpi1)); ( (debugparam.haltsegmentp1 == gpi1) || (debugparam.haltsegmentp2 == gpi1))
);
if (debugparam.haltface && debugparam.haltfacenr == facenr) if (debugparam.haltface && debugparam.haltfacenr == facenr)

View File

@ -2270,9 +2270,9 @@ namespace netgen
FaceDescriptor :: FaceDescriptor(const FaceDescriptor& other) FaceDescriptor :: FaceDescriptor(const FaceDescriptor& other)
: surfnr(other.surfnr), domin(other.domin), domout(other.domout), : surfnr(other.surfnr), domin(other.domin), domout(other.domout),
tlosurf(other.tlosurf), bcprop(other.bcprop), bcname(other.bcname), tlosurf(other.tlosurf), bcprop(other.bcprop),
domin_singular(other.domin_singular), domout_singular(other.domout_singular), surfcolour(other.surfcolour), bcname(other.bcname),
surfcolour(other.surfcolour) domin_singular(other.domin_singular), domout_singular(other.domout_singular)
{ {
firstelement = -1; firstelement = -1;
} }
@ -2337,14 +2337,14 @@ namespace netgen
ostream & operator<<(ostream & s, const FaceDescriptor & fd) ostream & operator<<(ostream & s, const FaceDescriptor & fd)
{ {
s << "surfnr = " << fd.surfnr s << "surfnr = " << fd.SurfNr()
<< ", domin = " << fd.domin << ", domin = " << fd.DomainIn()
<< ", domout = " << fd.domout << ", domout = " << fd.DomainOut()
<< ", tlosurf = " << fd.tlosurf << ", tlosurf = " << fd.TLOSurface()
<< ", bcprop = " << fd.bcprop << ", bcprop = " << fd.BCProperty()
<< ", domin_sing = " << fd.domin_singular << ", domin_sing = " << fd.DomainInSingular()
<< ", domout_sing = " << fd.domout_singular << ", domout_sing = " << fd.DomainOutSingular()
<< ", colour = " << fd.surfcolour; << ", colour = " << fd.SurfColour();
return s; return s;
} }

View File

@ -280,8 +280,8 @@ ostream & operator<<(ostream & s, const MeshPoint & pt);
typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS; // typedef MoveableArray<MeshPoint,PointIndex::BASE> T_POINTS;
// typedef Array<MeshPoint,PointIndex::BASE> T_POINTS; typedef Array<MeshPoint,PointIndex::BASE> T_POINTS;
class Element2d; class Element2d;
@ -422,7 +422,7 @@ public:
bool BadElement() const { return badel; } bool BadElement() const { return badel; }
friend ostream & operator<<(ostream & s, const Element2d & el); // friend ostream & operator<<(ostream & s, const Element2d & el);
friend class Mesh; friend class Mesh;
@ -785,15 +785,10 @@ public:
~Segment() ~Segment()
{ ; } { ; }
friend ostream & operator<<(ostream & s, const Segment & seg); // friend ostream & operator<<(ostream & s, const Segment & seg);
PointIndex pnums[3]; // p1, p2, pmid PointIndex pnums[3]; // p1, p2, pmid
/// point index 1
// PointIndex p1;
/// point index 2
// PointIndex p2;
/// edge nr
int edgenr; int edgenr;
/// ///
double singedge_left; double singedge_left;
@ -875,8 +870,7 @@ public:
// class Surface; // class Surface;
class FaceDescriptor; // class FaceDescriptor;
ostream & operator<< (ostream & s, const FaceDescriptor & fd);
/// ///
class FaceDescriptor class FaceDescriptor
@ -902,10 +896,9 @@ class FaceDescriptor
/// root of linked list /// root of linked list
SurfaceElementIndex firstelement; SurfaceElementIndex firstelement;
public:
///
double domin_singular; double domin_singular;
double domout_singular; double domout_singular;
public: public:
FaceDescriptor(); FaceDescriptor();
FaceDescriptor(int surfnri, int domini, int domouti, int tlosurfi); FaceDescriptor(int surfnri, int domini, int domouti, int tlosurfi);
@ -920,6 +913,11 @@ public:
int DomainOut () const { return domout; } int DomainOut () const { return domout; }
int TLOSurface () const { return tlosurf; } int TLOSurface () const { return tlosurf; }
int BCProperty () const { return bcprop; } int BCProperty () const { return bcprop; }
double DomainInSingular() const { return domin_singular; }
double DomainOutSingular() const { return domout_singular; }
// Philippose - 06/07/2009 // Philippose - 06/07/2009
// Get Surface colour // Get Surface colour
Vec3d SurfColour () const { return surfcolour; } Vec3d SurfColour () const { return surfcolour; }
@ -935,12 +933,32 @@ public:
// Set the surface colour // Set the surface colour
void SetSurfColour (Vec3d colour) { surfcolour = 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; 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; }
};

View File

@ -93,9 +93,6 @@ menu .ngmenu.file
lappend types {"ACIS Geometry" {.sat} } 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 ] set file [tk_getSaveFile -filetypes $types -initialdir $dirname -initialfile $basefilename ]
if {$file != ""} { if {$file != ""} {
Ng_SaveGeometry $file Ng_SaveGeometry $file
@ -234,13 +231,23 @@ loadmeshinifile;
} }
} }
.ngmenu.file add command -label "Export Mesh..." \ .ngmenu.file add command -label "Export Mesh..." \
-command { -command {
# global meshexportformats
foreach exportformat $meshexportformats {
if { [lindex $exportformat 0] == $exportfiletype } {
set extension [lindex $exportformat 1]
}
}
if { $exportfiletype == "Elmer Format" } { if { $exportfiletype == "Elmer Format" } {
set file [tk_chooseDirectory] set file [tk_chooseDirectory]
} else { } else {
set file [tk_getSaveFile] set file [tk_getSaveFile -filetypes "{ \"$exportfiletype\" {$extension} }" ]
} }
if {$file != ""} { if {$file != ""} {
Ng_ExportMesh $file $exportfiletype Ng_ExportMesh $file $exportfiletype
} }

View File

@ -269,16 +269,22 @@ int main(int argc, char ** argv)
// lookup user file formats and insert into format list: // lookup user file formats and insert into format list:
Array<const char*> userformats; Array<const char*> userformats;
RegisterUserFormats (userformats); Array<const char*> extensions;
RegisterUserFormats (userformats, extensions);
ostringstream fstr; ostringstream fstr;
tcl_const char * exportft = Tcl_GetVar (myinterp, "exportfiletype", 0);
for (int i = 1; i <= userformats.Size(); i++) for (int i = 1; i <= userformats.Size(); i++)
{
fstr << ".ngmenu.file.filetype add radio -label \"" fstr << ".ngmenu.file.filetype add radio -label \""
<< userformats.Get(i) << "\" -variable exportfiletype\n"; << 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_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, // For adding an application, parse the file here,

View File

@ -389,6 +389,7 @@ proc saveoptions { } {
set datei [open $file w] set datei [open $file w]
puts $datei "dirname ${dirname}" puts $datei "dirname ${dirname}"
puts $datei "loadgeomtypevar \"${loadgeomtypevar}\"" puts $datei "loadgeomtypevar \"${loadgeomtypevar}\""
puts $datei "exportfiletype \"${exportfiletype}\""
puts $datei "meshoptions.fineness ${meshoptions.fineness}" puts $datei "meshoptions.fineness ${meshoptions.fineness}"
puts $datei "meshoptions.firststep ${meshoptions.firststep}" puts $datei "meshoptions.firststep ${meshoptions.firststep}"
puts $datei "meshoptions.laststep ${meshoptions.laststep}" puts $datei "meshoptions.laststep ${meshoptions.laststep}"