Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_SGF_Interface.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2014 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_SGF_Interface.h,v $
27 //
28 // Purpose : This file contains auxilliary classes, etc. which
29 // are neccessary for outputting sgplot files, and
30 // also for reading SGF mesh files.
31 //
32 // Special Notes :
33 //
34 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
35 //
36 // Creation Date : 07/08/03
37 //
38 // Revision Information:
39 // ---------------------
40 //
41 // Revision Number: $Revision: 1.6.2.1 $
42 //
43 // Revision Date : $Date: 2014/02/26 20:16:31 $
44 //
45 // Current Owner : $Author: tvrusso $
46 //-----------------------------------------------------------------------------
47 
48 #ifndef Xyce_N_DEV_SGF_INTERFACE_h
49 #define Xyce_N_DEV_SGF_INTERFACE_h
50 
51 // ---------- Standard Includes ----------
52 
53 // ---------- Xyce Includes ----------
54 
55 // ---------- Forward Declarations -------
56 
57 //-----------------------------------------------------------------------------
58 // Legacy class definitions needed for sgplot output.
59 //-----------------------------------------------------------------------------
60 
61 #define LEN_IDENT 15 // identifier length
62 #define TYPE_ICONST 4 // integer constant
63 
64 class RESHEAD
65 {
66 public:
67  char szLogo[64]; // text logo
68  char szSign[16]; // signature
69  char szMeshFile[128]; // name of mesh file
70  UINT cConstant; // number of constants
71  UINT cVariable; // number of variables
72  UINT cArray; // number of arrays
73  UINT cElement; // number of elements
74  UINT c1DArray; // number of 1D arrays
75  UINT c2DArray; // number of 2D arrays
76  UINT c3DArray; // number of 3D arrays
77  UINT cSet; // number of data sets
78 };
79 
80 class XLATARRAY
81 {
82 public:
83  char szName[LEN_IDENT+1]; // array name
84  UINT uOffset; // array offset
85  UINT cDim; // number of dimensions
86  UINT acElements[3]; // elements per dimensions
87 };
88 
89 class XLATVAR
90 {
91 public:
92  char szName[LEN_IDENT+1]; // variable name
93  UINT uOffset; // variable offset
94 };
95 
96 
97 
98 //-----------------------------------------------------------------------------
99 // Class : DAXLATARRAY
100 // Purpose : Dynamic array of the XLATARRAY class
101 //
102 // Special Notes : This is only used for output sgplot style binary files.
103 // Otherwise, ignore.
104 //
105 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
106 // Creation Date : 09/29/02
107 //-----------------------------------------------------------------------------
109 { private:
110  UINT cSize; // total number of elements
111  UINT uInc; // increment size
112  UINT cElements; // number of elements in array
113  XLATARRAY *dynarray; // dynamic array
114 
115  void IncSize ()
116  { if (cElements == cSize)
117  { cSize += uInc;
118  dynarray =
119  (XLATARRAY *) realloc(dynarray, cSize*sizeof(XLATARRAY));
120  }
121  }
122 
123 public:
124  void set (const char *,UINT ,UINT,UINT,UINT,UINT);
125  UINT GetElements () { return cElements; }
126  UINT Add (XLATARRAY t) { IncSize(); dynarray[cElements] = t;
127  return cElements++; }
128 
129  void RemoveLast () { --cElements; }
130  void Flush () { cElements = 0; }
131 
132  XLATARRAY *GetPointer (UINT i) { return dynarray + i; }
133  XLATARRAY operator[] (UINT i) { return dynarray[i]; }
134 
135 public:
136  DAXLATARRAY (int numMeshPoints);
137  ~DAXLATARRAY () { delete [] dynarray; }
138 };
139 
140 #endif // Xyce_N_DEV_SGF_INTERFACE_h
141