00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __FDF_H
00034 #define __FDF_H
00035
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038 #include <iostream>
00039 using std::ostream;
00040 using std::endl;
00041
00042 #include <fstream>
00043 using std::ifstream;
00044 using std::ofstream;
00045
00046 #include <iomanip>
00047 using std::setw;
00048 using std::ios;
00049 using std::setprecision;
00050
00051 #include <string>
00052
00053 #include "OFELI_Config.h"
00054 #include "FFI.h"
00055 #include "NodeVect.h"
00056 #include "ElementVect.h"
00057 #include "SideVect.h"
00058 #include "EdgeVect.h"
00059 #include <vector>
00060 using std::vector;
00061
00062 namespace OFELI {
00063
00072 template <class T_> class NodeVect;
00073 template <class T_> class ElementVect;
00074 template <class T_> class SideVect;
00075 template <class T_> class EdgeVect;
00076 template <class T_> class Vect;
00077
00078 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00079 struct ErrorInFDF {
00080 void Message(const char *file, size_t line, int code, string p1=" ");
00081 };
00082 #endif
00083
00084
00085 enum {
00086 FDF_READ = 1,
00087 FDF_BIN_READ = 2,
00088 FDF_WRITE = 3,
00089 FDF_BIN_WRITE = 4,
00090 FDF_OPEN = 10,
00091 FDF_ACCESS = 20,
00092 FDF_CLOSE = 30,
00093 FDF_REGULAR = 60
00094 };
00095
00096
00106 class FDF
00107 {
00108
00109 public:
00110
00112 FDF() {
00113 #ifdef _OFELI_DEBUG
00114 std::clog << "An instance of class FDF is constructed.\n";
00115 std::clog << "File : " << __FILE__ << ", Line : " << __LINE__ << endl;
00116 #endif
00117 }
00118
00119 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00120 FDF(const string &file, char *access);
00121 #endif
00122
00131 FDF(const string &file, int access);
00132
00134 ~FDF();
00135
00138 void Open();
00139
00148 void Open(const string &file, int access);
00149
00151 void Close();
00152
00154 void put(const NodeVect<double> &v);
00155
00157 void put(const ElementVect<double> &v);
00158
00160 void put(const SideVect<double> &v);
00161
00170 void put(const Vect<double> &v, const string &name="u", size_t nb_dof=1, double t=0, int type=NODE_FIELD);
00171
00172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00173 void Put(const Vect<double> &v, const string &name="u", size_t nb_dof=1, double t=0, int type=NODE_FIELD);
00174 void Put(const NodeVect<double> &v);
00175 void Put(const ElementVect<double> &v);
00176 void Put(const SideVect<double> &v);
00177 double Get(Vect<double> &v);
00178 int Get(NodeVect<double> &v);
00179 int Get(NodeVect<double> &v, double &time);
00180 int Get(ElementVect<double> &v);
00181 int Get(ElementVect<double> &v, double &time);
00182 int Get(SideVect<double> &v);
00183 int Get(SideVect<double> &v, double &time);
00184 int Get(EdgeVect<double> &v);
00185 int Get(EdgeVect<double> &v, double &time);
00186 #endif
00187
00190 double get(Vect<double> &v);
00191
00193 int get(NodeVect<double> &v);
00194
00196 int get(NodeVect<double> &v, double &time);
00197
00199 int get(ElementVect<double> &v);
00200
00202 int get(ElementVect<double> &v, double &time);
00203
00205 int get(SideVect<double> &v);
00206
00208 int get(SideVect<double> &v, double &time);
00209
00211 int get(EdgeVect<double> &v);
00212
00214 int get(EdgeVect<double> &v, double &time);
00215
00217 void View(vector<double> &tm);
00218
00220 int getType() const;
00221
00222 private:
00223
00224 valarray<string> _kw;
00225 ofstream *_of;
00226 FFI *_ffi;
00227 string _file;
00228 int _access, _state, _type;
00229 bool _closed;
00230 ErrorInFDF _e;
00231 };
00232
00233 }
00234
00235 #endif