-
Notifications
You must be signed in to change notification settings - Fork 0
/
virtual_disp.h
187 lines (153 loc) · 5.49 KB
/
virtual_disp.h
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// Author: Justin Kinney
// Date: Sep 2008
#ifndef VIRTUAL_DISP_H
#define VIRTUAL_DISP_H 1
#include <cmath>
#include "log.h"
#include "controls.h"
#include "meshmorph.h"
typedef std::map<Vertex*,float,ltv> map_d;
typedef std::map<Vertex*,float,ltv>::iterator td_it;
typedef std::multimap<float,Vertex*,ltd> map_v;
typedef std::multimap<float,Vertex*,ltd>::iterator tv_it;
typedef std::multimap<float,Vertex*,ltd>::reverse_iterator tv_rit;
typedef std::multimap<float,Vertex*,ltd>::const_reverse_iterator tv_crit;
typedef std::multimap<float,Vertex*,ltd>::const_iterator tv_cit;
typedef std::vector<std::string>::const_iterator s_cit;
class Virtual_Disp
{
private:
static Virtual_Disp * only_one;
map_v vd2_to_v; // map of virtual displacement squared to vertex*
map_d v_to_vd2; // map of vertex* to virtual displacement squared
tv_rit seed; // virt disp map seed of vertex move collection
//vec_d seed_vd; // store virtual displacements of seed vertices
vec_s seed_vd; // store virtual displacements of seed vertices
// along with iteration number
vec_s seed_ad; // store actual displacements of seed vertices
// along with iteration number
Virtual_Disp (void);
Virtual_Disp (Virtual_Disp const &);
Virtual_Disp & operator = (Virtual_Disp const &);
~Virtual_Disp (void);
public:
static Virtual_Disp & instance (void);
void buildVirtDispMapComplement (void);
bool findVirtDispToVertAssoc (Vertex * const,float const &,tv_it &);
void buildVirtDispMap (const int &);
void setVirtualDisp (Vertex * const,float const &);
void updateVirtualDisp (Vertex * const,bool const,float const &);
void removeVirtDispToVertAssoc (Vertex * const,float const &);
bool getVertAndRank (Vertex * const,tv_it &,int &);
void resetForNewGroup (const int &);
void removeVertFromAllMaps (Vertex *);
void validateVirtDispMapComplement (void);
void validateVirtDispMap2 (void);
void validateVirtDispMap (void) const;
/** Store seed actual displacement to detect steady state of model.
*/
void addAdToSeedAd (const int & count,double ad)
{
seed_ad.push_back(Log::instance().format("%d %g",count,ad));
}
/** Store seed virtual displacement to detect steady state of model.
*/
void addVdToSeedVd (const int & count)
{
//double myvd = sqrt((*seed).first)/sqrt(Controls::instance().get_search_radius_sq());
double myvd = sqrt((*seed).first);
seed_vd.push_back(Log::instance().format("%d %g",count,myvd));
//seed_vd.push_back((*seed).first);
}
/** Get an iterator pointing to the first element in
* seed actual displacement vector.
* \return Iterator pointing to the first seed actual displacement element.
*/
//d_cit beginSeedActDisp (void)
s_cit beginSeedActDisp (void)
{
return seed_ad.begin();
}
/** Get an iterator pointing to one past the last element in
* seed actual displacement vector.
* \return Iterator pointing to one past the last seed actual displacement element.
*/
//d_cit endSeedActDisp (void)
s_cit endSeedActDisp (void)
{
return seed_ad.end();
}
/** Get an iterator pointing to the first element in
* seed virtual displacement vector.
* \return Iterator pointing to the first seed virtual displacement element.
*/
//d_cit beginSeedVirtDisp (void)
s_cit beginSeedVirtDisp (void)
{
return seed_vd.begin();
}
/** Get an iterator pointing to one past the last element in
* seed virtual displacement vector.
* \return Iterator pointing to one past the last seed virtual displacement element.
*/
//d_cit endSeedVirtDisp (void)
s_cit endSeedVirtDisp (void)
{
return seed_vd.end();
}
/** Retrieve an iterator pointing to seed of collection of vertices to move.
* \return Iterator pointing to element of virtual displacment map.
*/
tv_crit getSeed (void)
{
return seed;
}
/** Retrieve number of vertices in virtual displacement map.
* \return Number of elements in virtual displacement map.
*/
int getNumVertsInVirtDispMap (void)
{
return vd2_to_v.size();
}
/** Advance iterator to point to next element in map
* sorted by virtual displacement.
*/
void advanceSeedToNextLargestVert (void)
{
seed++;
}
/** Reset iterator to point to first element in map
* sorted by virtual displacement.
*/
void resetSeedToLargestVert (void)
{
seed = vd2_to_v.rbegin();
}
/** Get an iterator pointing to the first element in
* virtual displacement map.
* \return Iterator pointing to the first virtual displacement element.
*/
tv_cit beginVirtDispMap (void)
{
return vd2_to_v.begin();
}
/** Get a reverse iterator pointing to one past the last element in
* virtual displacement map.
* \return Reverse iterator pointing to one past
* the last virtual displacement element.
*/
tv_crit rendVirtDispMap (void)
{
return vd2_to_v.rend();
}
/** Get an iterator pointing to one past the last element in
* virtual displacement map.
* \return Iterator pointing to one past
* the last virtual displacement element.
*/
tv_cit endVirtDispMap (void)
{
return vd2_to_v.end();
}
};
#endif