ASCIITecplotToF5.hpp

00001 
00002 
00003 #ifndef ASCIITecplotToF5_H
00004 #define ASCIITecplotToF5_H
00005 
00006 #include <iostream>
00007 #include <fstream>
00008 #include <vector>
00009 #include <map>
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 
00013 #include <hdf5.h>
00014 #include <F5/F5uniform.h>
00015 #include <F5/F5B.h>
00016 #include <F5/F5R.h>
00017 #include <F5/F5F.h>
00018 #include <F5/F5X.h>
00019 #include <F5/F5defs.h>
00020 #include <F5/F5Bchart.h>
00021 #include <F5/F5L.h>
00022 #include <F5/F5private.h>
00023 
00024 //#include <F5/F5coordinates.h>
00025 
00026 
00027 class ASCIITecplotToF5
00028 {
00029 public:
00030         ASCIITecplotToF5(std::string inFilename, std::string outFilename, bool write_as_uniform);
00031 
00032         ~ASCIITecplotToF5()
00033                 { 
00034                         if(!Coords) free(Coords);
00035                         if(!vectorData) free(vectorData);               
00036                 };
00037         void ReadFile(std::string filename);
00038         void PushBackToken(const std::string &tok);
00039         std::string GetNextToken();
00040         void ParsePOINT(int numI, int numJ, int numK);
00041         void ParseArraysPoint(int numNodes);
00042         void POINTToF5(int numI, int numJ, int numK);
00043         void ConvertToF5(void);
00044         void WritePOINTSingleTimestep(F5Path* fpath, int numI, int numJ, int numK);
00045         void SetupCoordinates(int pointCount);
00046         void SetupVectorField(int pointCount);
00047         void ResetVariables(void);
00048 
00049 public: //public properties
00050         std::string inputFilename;
00051         std::string outputFilename;
00052         int startIndex;
00053         int currentIndex;
00054         int endIndex;
00055         int timeIncrement;
00056 
00057 protected:
00058         std::ifstream file;
00059 
00060         std::string saved_token;
00061         bool file_read;
00062         bool    write_as_uniform;
00063 
00064     char next_char;
00065     bool next_char_valid;
00066     bool next_char_eof;
00067     bool next_char_eol;
00068     bool token_was_string;
00069 
00070         //point position
00071     int Xindex;
00072     int Yindex;
00073     int Zindex;
00074         //vector field
00075         int Uindex;
00076     int Vindex;
00077     int Windex;
00078         int spatialDimension;
00079     int topologicalDimension;
00080 
00081         float time;
00082 
00083         F5_vec3_point_t*        Coords;
00084         F5_vec3_point_t         Coords_min, Coords_max;
00085         F5_vec3f_t*             vectorData;
00086 
00087 
00088         std::string                               title;
00089         int                                               numTotalVars;
00090         std::vector<std::string>  variableNames;
00091     std::vector<std::string>  allVariableNames;
00092         std::vector<int>          variableCellCentered;
00093         std::vector<std::string>  zoneTitles;
00094 
00095         std::vector<float*>               varsData;
00096 
00097         hid_t output;
00098 };
00099 
00100 #endif