Xyce  6.1
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-2015 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.9 $
42 //
43 // Revision Date : $Date: 2015/04/08 19:18:25 $
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 namespace {
65 typedef unsigned int UINT;
66 }
67 
68 class RESHEAD
69 {
70 public:
71  char szLogo[64]; // text logo
72  char szSign[16]; // signature
73  char szMeshFile[128]; // name of mesh file
74  UINT cConstant; // number of constants
75  UINT cVariable; // number of variables
76  UINT cArray; // number of arrays
77  UINT cElement; // number of elements
78  UINT c1DArray; // number of 1D arrays
79  UINT c2DArray; // number of 2D arrays
80  UINT c3DArray; // number of 3D arrays
81  UINT cSet; // number of data sets
82 };
83 
84 class XLATARRAY
85 {
86 public:
87  char szName[LEN_IDENT+1]; // array name
88  UINT uOffset; // array offset
89  UINT cDim; // number of dimensions
90  UINT acElements[3]; // elements per dimensions
91 };
92 
93 class XLATVAR
94 {
95 public:
96  char szName[LEN_IDENT+1]; // variable name
97  UINT uOffset; // variable offset
98 };
99 
100 
101 
102 //-----------------------------------------------------------------------------
103 // Class : DAXLATARRAY
104 // Purpose : Dynamic array of the XLATARRAY class
105 //
106 // Special Notes : This is only used for output sgplot style binary files.
107 // Otherwise, ignore.
108 //
109 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
110 // Creation Date : 09/29/02
111 //-----------------------------------------------------------------------------
113 { private:
114  UINT cSize; // total number of elements
115  UINT uInc; // increment size
116  UINT cElements; // number of elements in array
117  XLATARRAY *dynarray; // dynamic array
118 
119  void IncSize ()
120  { if (cElements == cSize)
121  { cSize += uInc;
122  dynarray =
123  (XLATARRAY *) realloc(dynarray, cSize*sizeof(XLATARRAY));
124  }
125  }
126 
127 public:
128  void set (const char *,UINT ,UINT,UINT,UINT,UINT);
129  UINT GetElements () { return cElements; }
130  UINT Add (XLATARRAY t) { IncSize(); dynarray[cElements] = t;
131  return cElements++; }
132 
133  void RemoveLast () { --cElements; }
134  void Flush () { cElements = 0; }
135 
136  XLATARRAY *GetPointer (UINT i) { return dynarray + i; }
137  XLATARRAY operator[] (UINT i) { return dynarray[i]; }
138 
139 public:
140  DAXLATARRAY (int numMeshPoints);
141  ~DAXLATARRAY () { delete [] dynarray; }
142 };
143 
144 #endif // Xyce_N_DEV_SGF_INTERFACE_h
145 
UINT Add(XLATARRAY t)
char szName[15+1]
char szName[15+1]
char szLogo[64]
UINT acElements[3]
XLATARRAY * dynarray
DAXLATARRAY(int numMeshPoints)
XLATARRAY operator[](UINT i)
char szSign[16]
XLATARRAY * GetPointer(UINT i)
#define LEN_IDENT
char szMeshFile[128]
void set(const char *, UINT, UINT, UINT, UINT, UINT)