summaryrefslogtreecommitdiffstats
path: root/lib/tqwtplot3d/examples/mesh2/src/femreader.h
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-11 14:15:27 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-11 14:15:27 -0500
commitb85a292ce06475d560bfa1195b63a8bfe211f22d (patch)
tree463d71be55ff807513139f1de106aef6bdd7b4db /lib/tqwtplot3d/examples/mesh2/src/femreader.h
parentce039289815e2802fdeca8d384126c807ca9cb58 (diff)
downloadulab-b85a292ce06475d560bfa1195b63a8bfe211f22d.tar.gz
ulab-b85a292ce06475d560bfa1195b63a8bfe211f22d.zip
Add 0.2.7 release of qwtplot3d for future TQt3 conversion and use
Diffstat (limited to 'lib/tqwtplot3d/examples/mesh2/src/femreader.h')
-rw-r--r--lib/tqwtplot3d/examples/mesh2/src/femreader.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/lib/tqwtplot3d/examples/mesh2/src/femreader.h b/lib/tqwtplot3d/examples/mesh2/src/femreader.h
new file mode 100644
index 0000000..374a181
--- /dev/null
+++ b/lib/tqwtplot3d/examples/mesh2/src/femreader.h
@@ -0,0 +1,83 @@
+#ifndef femreader_h__2004_03_07_14_03_begin_guarded_code
+#define femreader_h__2004_03_07_14_03_begin_guarded_code
+
+#include <math.h>
+#include <fstream>
+#include "qwt3d_global.h"
+#include "qwt3d_types.h"
+
+class NodeFilter
+{
+ public:
+ explicit NodeFilter()
+ {
+ values = std::vector<double>(6);
+ }
+
+ Qwt3D::Triple readLine(std::ifstream& str)
+ {
+ for (unsigned i = 0; i!=values.size(); ++i)
+ str >> values[i];
+
+ return Qwt3D::Triple(values[1], values[2], values[5] / 1000);
+ }
+
+ private:
+ std::vector<double> values;
+};
+
+class CellFilter
+{
+ public:
+
+ Qwt3D::Cell readLine(std::ifstream& str)
+ {
+ Qwt3D::Cell cell(4);
+ str >> cell[0]; // dummy (cell number) - overridden in next step
+ for (unsigned i = 0; i<cell.size(); ++i)
+ {
+ str >> cell[i];
+ cell[i] = cell[i] - 1;
+ }
+ return cell;
+ }
+};
+
+
+template <typename FILTER>
+bool readNodes(Qwt3D::TripleField& v, const char* fname, FILTER fil)
+{
+ std::ifstream file(fname);
+
+ v.clear();
+
+ Qwt3D::Triple t;
+ while ( file )
+ {
+ t = fil.readLine( file );
+ if (!file.good())
+ break;
+ v.push_back( t );
+ }
+ return true;
+}
+
+template <typename FILTER>
+bool readConnections(Qwt3D::CellField& v, const char* fname, FILTER fil)
+{
+ std::ifstream file(fname);
+
+ v.clear();
+
+ Qwt3D::Cell cell;
+ while ( file )
+ {
+ cell = fil.readLine( file );
+ if (!file.good())
+ break;
+ v.push_back(cell);
+ }
+ return true;
+}
+
+#endif /* include guarded */