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 const int nspmd2 = (*nspmd)*(*nspmd);
113 std::vector<Candidates> candidates(nspmd2, std::vector<std::pair<int,int>>());
114 Remotes secondaryRemotes(nspmd2, std::vector<int>());
115
116 for(int i = 0 ; i < *nbCand ; i++)
117 {
118
119 const int currentM = candM[i] - 1;
120 const int currentS = candS[i] - 1;
121 assert(currentM < *sizeM);
122 assert(currentM >= 0 );
123 assert(currentS < *sizeS);
124 assert(currentS >= 0 );
125 const int domainM = cepM[currentM];
126 const int domainS = cepS[currentS];
127 const int oneD = domainM * (*nspmd) + domainS;
128
129
130
131
132
133
134
135
136
137 assert(domainM >= 0);
138 assert(domainM < *
nspmd);
139 assert(domainS >=0);
140 assert(domainS < *
nspmd);
141 if(domainS != domainM)
142 {
143
144 candidates[oneD].push_back(std::make_pair(i,localIdS[currentS]));
145
146 }
147
148 candM[i] = localIdM[currentM];
149 candS[i] = localIdS[currentS];
150 localIdx[i] = localIdS[currentS];
151
152 }
153
154 for(
int domainM = 0 ; domainM < *
nspmd ; domainM++)
155 {
157 for(
int domainS = 0 ; domainS < *
nspmd ; domainS++)
158 {
159
160 const int oneD = domainM * (*nspmd) + domainS;
161 secondaryRemoteCount[oneD] = 0;
162 secondaryRemotes[oneD] = {} ;
163 if(domainS != domainM)
164 {
165
166
167 std::map<int,VectOfCandPtr> secondaryToCand;
168
169
170 std::set<int> secondarySet;
171
172
173
174
175 for(auto & c : candidates[oneD])
176 {
177 auto it = secondarySet.insert(c.second);
178 secondaryToCand[c.second].push_back(&(c));
179 }
180
181 secondaryRemotes[oneD].assign(secondarySet.begin(),secondarySet.end());
182
183
184
185 secondaryRemoteCount[oneD] = secondaryRemotes[oneD].size();
187
188
189
190 for(auto & sc : secondaryToCand)
191 {
192 idxInFi++;
193 for(auto & ptr : sc.second)
194 {
195
196 (*ptr).second = -( idxInFi);
197
198 candS[(*ptr).first] = -(idxInFi);
199 }
200 }
201
202 } else
203 {
204 secondaryRemoteCount[oneD] = 0;
205 }
206 offset+= secondaryRemoteCount[oneD];
207 }
208 }
209
210
211
212
213
214
215
216
217
218
219}
integer, dimension(:), allocatable offset