Back to index

salome-smesh  6.5.0
UNV2420_Structure.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef UNV2420_Structure_HeaderFile
00024 #define UNV2420_Structure_HeaderFile
00025 
00026 // Name:   Coordinate Systems
00027 // -----------------------------------------------------------------------
00028 
00029 // Record 1:        FORMAT (1I10)
00030 //                  Field 1       -- Part UID
00031 
00032 // Record 2:        FORMAT (40A2)
00033 //                  Field 1       -- Part Name
00034 
00035 // Record 3:        FORMAT (3I10)
00036 //                  Field 1       -- Coordinate System Label
00037 //                  Field 2       -- Coordinate System Type
00038 //                                   = 0, Cartesian
00039 //                                   = 1, Cylindrical
00040 //                                   = 2, Spherical
00041 //                  Field 3       -- Coordinate System Color
00042 
00043 // Record 4:        FORMAT (40A2)
00044 //                  Field 1       -- Coordinate System Name
00045 
00046 // Record 5:        FORMAT (1P3D25.16)
00047 //                  Field 1-3     -- Transformation Matrix Row 1
00048 
00049 // Record 6:        FORMAT (1P3D25.16)
00050 //                  Field 1-3     -- Transformation Matrix Row 2
00051 
00052 // Record 7:        FORMAT (1P3D25.16)
00053 //                  Field 1-3     -- Transformation Matrix Row 3
00054 
00055 // Record 8:        FORMAT (1P3D25.16)
00056 //                  Field 1-3     -- Transformation Matrix Row 4
00057 
00058 // Records 3 thru 8 are repeated for each Coordinate System in the Part.
00059 
00060 // Example:
00061 //     -1
00062 //   2420
00063 //        100
00064 // Untitled
00065 //          6         1        15
00066 // FEMAP Global Cylindrical (6)
00067 //     1.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
00068 //     0.0000000000000000E+0    1.0000000000000000E+0    0.0000000000000000E+0
00069 //     0.0000000000000000E+0    0.0000000000000000E+0    1.0000000000000000E+0
00070 //     0.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
00071 //          7         2        15
00072 // Coordinate System 4
00073 //     1.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
00074 //     0.0000000000000000E+0    1.0000000000000000E+0    0.0000000000000000E+0
00075 //     0.0000000000000000E+0    0.0000000000000000E+0    1.0000000000000000E+0
00076 //     0.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
00077 //     -1
00078 
00079 #include "SMESH_DriverUNV.hxx"
00080 
00081 #include <string>
00082 #include <vector>
00083 
00084 namespace UNV2420
00085 {
00086   enum { Cartesian=0, Cylindrical, Spherical };
00087 
00088   typedef int TCSLabel; // type of coord system label
00089 
00090   struct MESHDRIVERUNV_EXPORT TRecord
00091   {
00092     TCSLabel    coord_sys_label; 
00093     int         coord_sys_type;  // { Cartesian=0, Cylindrical, Spherical }
00094     int         coord_sys_color;
00095     std::string coord_sys_name;
00096     double      matrix[4][3];
00097 
00098     bool        isIdentityMatrix() const;
00099     void        ApplyMatrix      ( double* coords ) const;
00100     static void FromCylindricalCS( double* coords );
00101     static void FromSphericalCS  ( double* coords );
00102   };
00103   
00104   typedef std::vector<TRecord> TDataSet;
00105 
00106   MESHDRIVERUNV_EXPORT void
00107   Read(std::ifstream& in_stream,
00108        std::string&   part_name, // can re-store a mesh name
00109        TDataSet&      theDataSet);
00110 
00111   MESHDRIVERUNV_EXPORT void
00112   Write(std::ofstream&     out_stream,
00113         const std::string& part_name); // can store a mesh name
00114   //    const TDataSet&    theDataSet);
00115 
00116 };
00117 
00118 
00119 #endif