File: Point.code

package info (click to toggle)
paraview 4.1.0%2Bdfsg%2B1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 278,136 kB
  • ctags: 340,527
  • sloc: cpp: 2,314,053; ansic: 817,139; python: 245,770; xml: 68,996; tcl: 48,285; fortran: 39,116; yacc: 5,713; java: 3,827; perl: 3,108; sh: 2,045; lex: 1,809; makefile: 935; asm: 471; pascal: 228
file content (152 lines) | stat: -rw-r--r-- 3,597 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Function: Point
Declaration: Point(double,double,double);
Definition:
// ****************************************************************************
//  Method:  Point::Point
//
//  Purpose:
//    Constructor which takes a triple of values as input.
//
//  Arguments:
//    ox,oy,oz   the coordinate
//
//  Programmer:  Jeremy Meredith
//  Creation:    March 15, 2002
//
// ****************************************************************************

Point::Point(double ox, double oy, double oz) : AttributeSubject("s")
{
    char str[100];
    sprintf(str, "%g %g %g", ox, oy, oz);
    value = str;
}

Function: GetValueType
Declaration: ValueType GetValueType() const;
Definition:
// ****************************************************************************
//  Method:  Point::GetValueType
//
//  Purpose:
//    Get the type of function or tuple contained in the Point.
//
//  Programmer:  Jeremy Meredith
//  Creation:    March 15, 2002
//
// ****************************************************************************
Point::ValueType
Point::GetValueType() const
{
    int i;
    char s[1000];
    double d;

    if (GetTupleArgs(d,d,d))
        return VT_Tuple;
    if (GetMinArgs(s))
        return VT_Min;
    if (GetMaxArgs(s))
        return VT_Max;
    if (GetDomainZoneArgs(i,i))
        return VT_DomainZone;
    if (GetZoneArgs(i))
        return VT_Zone;
    if (GetDomainNodeArgs(i,i))
        return VT_DomainNode;
    if (GetNodeArgs(i))
        return VT_Node;

    return VT_Unknown;
}

Function: GetTupleArgs
Declaration: bool GetTupleArgs(double&, double&, double&) const;
Definition:
// ****************************************************************************
//  Methods to parse tuples, functions, and arguments
// ****************************************************************************

bool
Point::GetTupleArgs(double &d1, double &d2, double &d3) const
{
    const char *str = value.c_str();
    return (sscanf(str, "%lg %lg %lg", &d1, &d2, &d3) == 3);
}

Function: GetMinArgs
Declaration: bool GetMinArgs(char*) const;
Definition:
bool
Point::GetMinArgs(char *s) const
{
    const char *str = value.c_str();
    if (sscanf(str, "min( %[^) ] )", s) == 1)
        return true;
    else if (strcmp(str, "min()") == 0)
    {
        s[0] = '\0';
        return true;
    }
    else
        return false;
}

Function: GetMaxArgs
Declaration: bool GetMaxArgs(char*) const;
Definition:
bool
Point::GetMaxArgs(char *s) const
{
    const char *str = value.c_str();
    if (sscanf(str, "max( %[^) ] )", s) == 1)
        return true;
    else if (strcmp(str, "min()") == 0)
    {
        s[0] = '\0';
        return true;
    }
    else
        return false;
}

Function: GetDomainZoneArgs
Declaration: bool GetDomainZoneArgs(int&, int&) const;
Definition:
bool
Point::GetDomainZoneArgs(int &d, int &z) const
{
    const char *str = value.c_str();
    return (sscanf(str, "zone( %d %d )", &d, &z) == 2);
}

Function: GetZoneArgs
Declaration: bool GetZoneArgs(int&) const;
Definition:
bool
Point::GetZoneArgs(int &z) const
{
    const char *str = value.c_str();
    return (sscanf(str, "zone( %d )", &z) == 1);
}

Function: GetDomainNodeArgs
Declaration: bool GetDomainNodeArgs(int&, int&) const;
Definition:
bool
Point::GetDomainNodeArgs(int &d, int &n) const
{
    const char *str = value.c_str();
    return (sscanf(str, "node( %d %d )", &d, &n) == 2);
}

Function: GetNodeArgs
Declaration: bool GetNodeArgs(int&) const;
Definition:
bool
Point::GetNodeArgs(int &n) const
{
    const char *str = value.c_str();
    return (sscanf(str, "node( %d )", &n) == 1);
}