Salome HOME
23080: [CEA 1497] Do not merge a middle node in quadratic with the extreme nodes...
[modules/smesh.git] / src / DriverUNV / UNV2420_Structure.hxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef UNV2420_Structure_HeaderFile
24 #define UNV2420_Structure_HeaderFile
25
26 // Name:   Coordinate Systems
27 // -----------------------------------------------------------------------
28
29 // Record 1:        FORMAT (1I10)
30 //                  Field 1       -- Part UID
31
32 // Record 2:        FORMAT (40A2)
33 //                  Field 1       -- Part Name
34
35 // Record 3:        FORMAT (3I10)
36 //                  Field 1       -- Coordinate System Label
37 //                  Field 2       -- Coordinate System Type
38 //                                   = 0, Cartesian
39 //                                   = 1, Cylindrical
40 //                                   = 2, Spherical
41 //                  Field 3       -- Coordinate System Color
42
43 // Record 4:        FORMAT (40A2)
44 //                  Field 1       -- Coordinate System Name
45
46 // Record 5:        FORMAT (1P3D25.16)
47 //                  Field 1-3     -- Transformation Matrix Row 1
48
49 // Record 6:        FORMAT (1P3D25.16)
50 //                  Field 1-3     -- Transformation Matrix Row 2
51
52 // Record 7:        FORMAT (1P3D25.16)
53 //                  Field 1-3     -- Transformation Matrix Row 3
54
55 // Record 8:        FORMAT (1P3D25.16)
56 //                  Field 1-3     -- Transformation Matrix Row 4
57
58 // Records 3 thru 8 are repeated for each Coordinate System in the Part.
59
60 // Example:
61 //     -1
62 //   2420
63 //        100
64 // Untitled
65 //          6         1        15
66 // FEMAP Global Cylindrical (6)
67 //     1.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
68 //     0.0000000000000000E+0    1.0000000000000000E+0    0.0000000000000000E+0
69 //     0.0000000000000000E+0    0.0000000000000000E+0    1.0000000000000000E+0
70 //     0.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
71 //          7         2        15
72 // Coordinate System 4
73 //     1.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
74 //     0.0000000000000000E+0    1.0000000000000000E+0    0.0000000000000000E+0
75 //     0.0000000000000000E+0    0.0000000000000000E+0    1.0000000000000000E+0
76 //     0.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
77 //     -1
78
79 #include "SMESH_DriverUNV.hxx"
80
81 #include <string>
82 #include <vector>
83
84 namespace UNV2420
85 {
86   enum { Cartesian=0, Cylindrical, Spherical };
87
88   typedef int TCSLabel; // type of coord system label
89
90   struct MESHDRIVERUNV_EXPORT TRecord
91   {
92     TCSLabel    coord_sys_label; 
93     int         coord_sys_type;  // { Cartesian=0, Cylindrical, Spherical }
94     int         coord_sys_color;
95     std::string coord_sys_name;
96     double      matrix[4][3];
97
98     bool        isIdentityMatrix() const;
99     void        ApplyMatrix      ( double* coords ) const;
100     static void FromCylindricalCS( double* coords );
101     static void FromSphericalCS  ( double* coords );
102   };
103   
104   typedef std::vector<TRecord> TDataSet;
105
106   MESHDRIVERUNV_EXPORT void
107   Read(std::ifstream& in_stream,
108        std::string&   part_name, // can re-store a mesh name
109        TDataSet&      theDataSet);
110
111   MESHDRIVERUNV_EXPORT void
112   Write(std::ofstream&     out_stream,
113         const std::string& part_name); // can store a mesh name
114   //    const TDataSet&    theDataSet);
115
116 };
117
118
119 #endif