1#ifndef MESHINTERFACE_def_hpp
2#define MESHINTERFACE_def_hpp
3#include "MeshInterface_decl.hpp"
17std::vector<T> sort_from_ref(
18 std::vector<T>
const& in,
19 std::vector<int>
const& reference
21 std::vector<T> ret(in.size());
23 int const size = in.size();
24 for (
int i = 0; i < size; ++i)
25 ret[i] = in[reference[i]];
31std::vector<T> sort_from_ref(
32 std::vector<T>
const& in,
33 std::vector<long long>
const& reference
35 std::vector<T> ret(in.size());
37 int const size = in.size();
38 for (
long long i = 0; i < size; ++i)
39 ret[i] = in[reference[i]];
46template <
class SC,
class LO,
class GO,
class NO>
47MeshInterface<SC,LO,GO,NO>::MeshInterface():
48indicesGlobalMatched_(),
49indicesGlobalMatchedOrigin_(),
50indicesGlobalMatchedUnique_(),
52partialCouplingFlag_(0),
53partialCouplingType_(0),
59template <
class SC,
class LO,
class GO,
class NO>
60MeshInterface<SC,LO,GO,NO>::MeshInterface(CommConstPtr_Type comm):
61indicesGlobalMatched_(),
62indicesGlobalMatchedOrigin_(),
63indicesGlobalMatchedUnique_(),
65partialCouplingFlag_(0),
66partialCouplingType_(0),
72template <
class SC,
class LO,
class GO,
class NO>
73void MeshInterface<SC,LO,GO,NO>::partitionMeshInterface(MapPtr_Type mapRepeated, MapPtr_Type mapUnique){
76 vec3D_GO_ptr_Type indicesSerial = indicesGlobalMatchedOrigin_;
79 indicesGlobalMatched_.reset(
new vec3D_GO_Type ( indicesSerial->size() , vec2D_GO_Type( 2 , vec_GO_Type(0) ) ) );
82 indicesGlobalMatchedUnique_.reset(
new vec3D_GO_Type ( indicesSerial->size() , vec2D_GO_Type( 2 , vec_GO_Type(0) ) ) );
84 for (
int flag=0; flag<indicesSerial->size(); flag++) {
85 for (
int i=0; i<indicesSerial->at(flag).at(0).size(); i++) {
87 GO indexThis = mapRepeated->getLocalElement( indicesSerial->at(flag).at(0).at(i) );
88 if ( indexThis != Teuchos::OrdinalTraits<LO>::invalid() ) {
89 indicesGlobalMatched_->at(flag).at(0).push_back( indicesSerial->at(flag).at(0).at(i) );
90 indicesGlobalMatched_->at(flag).at(1).push_back( indicesSerial->at(flag).at(1).at(i) );
93 GO indexThisUni = mapUnique->getLocalElement( indicesSerial->at(flag).at(0).at(i) );
95 if ( indexThisUni != Teuchos::OrdinalTraits<LO>::invalid() ) {
96 indicesGlobalMatchedUnique_->at(flag).at(0).push_back( indicesSerial->at(flag).at(0).at(i) );
97 indicesGlobalMatchedUnique_->at(flag).at(1).push_back( indicesSerial->at(flag).at(1).at(i) );
103 isPartitioned_ =
true;
107template <
class SC,
class LO,
class GO,
class NO>
108void MeshInterface<SC,LO,GO,NO>::determineInterface( vec2D_dbl_ptr_Type pointsRepThis, vec2D_dbl_ptr_Type pointsRepOther, vec_int_ptr_Type flagThis, vec_int_ptr_Type flagOther, vec_int_Type relevant_flag_vec ){
110 indicesGlobalMatched_.reset(
new vec3D_GO_Type( relevant_flag_vec.size(), vec2D_GO_Type(2) ) );
113 indicesGlobalMatchedOrigin_.reset(
new vec3D_GO_Type( relevant_flag_vec.size(), vec2D_GO_Type(2) ) );
116 for (
int flag=0; flag<relevant_flag_vec.size(); flag++) {
117 vec2D_dbl_Type pointThis(0);
118 vec2D_dbl_Type pointOther(0);
119 vec_GO_Type indexGlobalThis(0);
120 vec_GO_Type indexGlobalOther(0);
121 vec_int_Type indexThis(0);
122 vec_int_Type indexOther(0);
124 for (
int i=0; i<pointsRepThis->size(); i++) {
125 if (flagThis->at(i) == relevant_flag_vec.at(flag)) {
126 pointThis.push_back( pointsRepThis->at(i) );
127 indexGlobalThis.push_back(i);
128 indexThis.push_back(counter);
133 for (
int i=0; i<pointsRepOther->size(); i++) {
134 if (flagOther->at(i) == relevant_flag_vec.at(flag)) {
135 pointOther.push_back( pointsRepOther->at(i) );
136 indexGlobalOther.push_back(i);
137 indexOther.push_back(counter);
142 std::cout <<
"serial determineInterface - number flag nodes this:" << indexThis.size()<<
" other:" << indexOther.size() << std::endl;
144 sort(indexThis.begin(), indexThis.end(),
145 [&](
const int& a,
const int& b) {
146 return pointThis[a] < pointThis[b];
150 sort(indexOther.begin(), indexOther.end(),
151 [&](
const int& a,
const int& b) {
152 return pointOther[a] < pointOther[b];
156 indexGlobalThis = sort_from_ref(indexGlobalThis, indexThis);
157 indexGlobalOther = sort_from_ref(indexGlobalOther, indexOther);
159 TEUCHOS_TEST_FOR_EXCEPTION( indexGlobalThis.size()!=indexGlobalOther.size(), std::logic_error,
"Interfaces do not have the same length!");
162 indicesGlobalMatched_->at(flag).at(0) = indexGlobalThis;
163 indicesGlobalMatched_->at(flag).at(1) = indexGlobalOther;
165 indicesGlobalMatchedOrigin_->at(flag).at(0) = indexGlobalThis;
166 indicesGlobalMatchedOrigin_->at(flag).at(1) = indexGlobalOther;
172template <
class SC,
class LO,
class GO,
class NO>
173int MeshInterface<SC,LO,GO,NO>::isPartialCouplingFlag(
int flag){
175 auto it = std::find( partialCouplingFlag_.begin(), partialCouplingFlag_.end(), flag );
176 if ( it!=partialCouplingFlag_.end() )
177 return std::distance( partialCouplingFlag_.begin(), it );
182template <
class SC,
class LO,
class GO,
class NO>
183void MeshInterface<SC,LO,GO,NO>::setPartialCoupling(
int flag, std::string type){
184 partialCouplingFlag_.push_back(flag);
185 partialCouplingType_.push_back(type);
189template <
class SC,
class LO,
class GO,
class NO>
190int MeshInterface<SC,LO,GO,NO>::getPartialCouplingFlag(
int i){
191 TEUCHOS_TEST_FOR_EXCEPTION(sizePartialCoupling()-1 < i, std::runtime_error,
"There is no partial coupling for this index");
192 return partialCouplingFlag_[i];
195template <
class SC,
class LO,
class GO,
class NO>
196std::string MeshInterface<SC,LO,GO,NO>::getPartialCouplingType(
int i){
197 TEUCHOS_TEST_FOR_EXCEPTION(sizePartialCoupling()-1 < i, std::runtime_error,
"There is no partial coupling for this index");
198 return partialCouplingType_[i];
201template <
class SC,
class LO,
class GO,
class NO>
202int MeshInterface<SC,LO,GO,NO>::sizePartialCoupling(){
203 return partialCouplingFlag_.size();
206template <
class SC,
class LO,
class GO,
class NO>
207void MeshInterface<SC,LO,GO,NO>::determineInterfaceParallelAndDistance( vec2D_dbl_ptr_Type pointsUniThis, vec2D_dbl_ptr_Type pointsUniOther, vec_int_ptr_Type flagUniThis, vec_int_ptr_Type flagUniOther, vec_int_Type relevant_flag_vec, MapConstPtr_Type mapUniThis, MapConstPtr_Type mapUniOther, vec_dbl_ptr_Type &distancesToInterface, vec2D_dbl_ptr_Type pointsRepThis,
int dim ) {
209 SC eps100 = 100. * Teuchos::ScalarTraits<SC>::eps();
210 GO invalid = Teuchos::OrdinalTraits<GO>::invalid();
212 indicesGlobalMatched_.reset(
new vec3D_GO_Type( relevant_flag_vec.size(), vec2D_GO_Type(2) ) );
217 indicesGlobalMatchedOrigin_.reset(
new vec3D_GO_Type( relevant_flag_vec.size(), vec2D_GO_Type(2) ) );
220 for (
int flagIndex=0; flagIndex<relevant_flag_vec.size(); flagIndex++) {
221 int flag = relevant_flag_vec[flagIndex];
223 vec_GO_Type indexGlobalCommThis(0);
224 vec_GO_Type indexGlobalCommOther(0);
226 for (
int i=0; i<pointsUniThis->size(); i++) {
227 if ( flagUniThis->at(i) == flag ) {
228 indexGlobalCommThis.push_back( mapUniThis->getGlobalElement( i ) );
232 for (
int i=0; i<pointsUniOther->size(); i++) {
233 if ( flagUniOther->at(i) == flag ) {
234 indexGlobalCommOther.push_back( mapUniOther->getGlobalElement( i ) );
240 GO numInterfaceGlobalThis = 0;
241 GO numInterfaceGlobalOther = 0;
243 Teuchos::reduceAll( *this->comm_, Teuchos::REDUCE_SUM, (GO) indexGlobalCommThis.size(), Teuchos::ptrFromRef( numInterfaceGlobalThis ) );
245 Teuchos::reduceAll( *this->comm_, Teuchos::REDUCE_SUM, (GO) indexGlobalCommOther.size(), Teuchos::ptrFromRef( numInterfaceGlobalOther ) );
247 MapPtr_Type mapThis = Teuchos::rcp(
new Map_Type( -1, Teuchos::arrayViewFromVector( indexGlobalCommThis ), 0, this->comm_ ) );
249 MapPtr_Type mapOther = Teuchos::rcp(
new Map_Type( -1, Teuchos::arrayViewFromVector( indexGlobalCommOther ), 0, this->comm_ ) );
251 std::cout <<
"numInterfaceGlobalThis:" << numInterfaceGlobalThis << std::endl;
252 std::cout <<
"numInterfaceGlobalOther:" << numInterfaceGlobalOther << std::endl;
253 TEUCHOS_TEST_FOR_EXCEPTION( numInterfaceGlobalThis != numInterfaceGlobalOther, std::runtime_error,
"DetermineInterfaceInParallel failed. ThisMesh and OtherMesh seem to have different numbers of interface nodes." );
255 std::vector<GO> gatherAllIndices(numInterfaceGlobalThis);
256 std::iota ( std::begin( gatherAllIndices ), std::end( gatherAllIndices ), 0 );
258 MapPtr_Type linearMapThis = Teuchos::rcp(
new Map_Type( numInterfaceGlobalThis, indexGlobalCommThis.size(), 0, this->comm_ ) );
259 MapPtr_Type linearMapOther = Teuchos::rcp(
new Map_Type(numInterfaceGlobalThis, indexGlobalCommOther.size(), 0, this->comm_ ) );
260 MapPtr_Type gatherAllMap = Teuchos::rcp(
new Map_Type( invalid, Teuchos::arrayViewFromVector( gatherAllIndices ), 0, this->comm_ ) );
264 vec_int_Type localSizeThis( this->comm_->getSize(),0 );
265 vec_int_Type localSizeOther( this->comm_->getSize(),0 );
268 int sizeThis = indexGlobalCommThis.size();
269 int sizeOther = indexGlobalCommOther.size();
270 Teuchos::gather<int, int>( &sizeThis, 1, &localSizeThis[0], 1, root, *this->comm_ );
271 Teuchos::gather<int, int>( &sizeOther, 1, &localSizeOther[0], 1, root, *this->comm_ );
274 if (indexGlobalCommThis.size()>0)
275 sendThis = &indexGlobalCommThis[0];
276 GO* sendOther = NULL;
277 if (indexGlobalCommOther.size()>0)
278 sendOther = &indexGlobalCommOther[0];
280 vec_GO_Type gatheredThis( numInterfaceGlobalThis , -1);
281 vec_GO_Type gatheredOther( numInterfaceGlobalThis, -1);
283 vec_int_Type displacementsThis( ((
int) this->comm_->getRank()==root ) * this->comm_->getSize(),0 );
284 vec_int_Type displacementsOther( ((
int) this->comm_->getRank()==root ) * this->comm_->getSize(),0 );
285 int* displThis = NULL;
286 if (displacementsThis.size()>0)
287 displThis = &displacementsThis[0];
288 int* displOther = NULL;
289 if (displacementsOther.size()>0)
290 displOther = &displacementsOther[0];
292 for (
int i=1; i<displacementsThis.size(); i++)
293 displacementsThis[i] = displacementsThis[i-1] + localSizeThis[i-1];
294 for (
int i=1; i<displacementsOther.size(); i++)
295 displacementsOther[i] = displacementsOther[i-1] + localSizeOther[i-1];
297 Teuchos::gatherv<int,GO>( sendThis, indexGlobalCommThis.size(), &gatheredThis[0], &localSizeThis[0], displThis, root, *this->comm_ );
298 Teuchos::gatherv<int,GO>( sendOther, indexGlobalCommOther.size(), &gatheredOther[0], &localSizeOther[0], displOther, root, *this->comm_ );
301 Teuchos::broadcast<int,GO>( *this->comm_, root, Teuchos::arrayViewFromVector( gatheredThis ) );
302 Teuchos::broadcast<int,GO>( *this->comm_, root, Teuchos::arrayViewFromVector( gatheredOther ) );
304 MapPtr_Type mapAllThis = Teuchos::rcp(
new Map_Type(invalid, Teuchos::arrayViewFromVector( gatheredThis ), 0, this->comm_ ) );
305 MapPtr_Type mapAllOther = Teuchos::rcp(
new Map_Type( invalid, Teuchos::arrayViewFromVector( gatheredOther ), 0, this->comm_ ) );
307 bool meshOnRank =
false;
308 if (pointsUniThis->size() > 0)
311 MultiVectorPtr_Type mvLocalThis;
312 MultiVectorPtr_Type mvLocalOther;
314 mvLocalThis = Teuchos::rcp(
new MultiVector_Type( mapThis, dim + 1 ) );
315 mvLocalOther = Teuchos::rcp(
new MultiVector_Type( mapOther, dim + 1 ) );
319 for (
int j=0; j<dim; j++) {
320 Teuchos::ArrayRCP< SC > data = mvLocalThis->getDataNonConst(j);
321 for (
int i=0; i<data.size(); i++) {
322 LO index = mapUniThis->getLocalElement( indexGlobalCommThis[i] );
323 data[i] = pointsUniThis->at( index )[j];
327 Teuchos::ArrayRCP< SC > dataThis = mvLocalThis->getDataNonConst( dim );
328 for (
int i=0; i<dataThis.size(); i++)
329 dataThis[i] = indexGlobalCommThis[i];
333 for (
int j=0; j<dim; j++) {
334 Teuchos::ArrayRCP< SC > data = mvLocalOther->getDataNonConst(j);
335 for (
int i=0; i<data.size(); i++) {
336 LO index = mapUniOther->getLocalElement( indexGlobalCommOther[i] );
337 data[i] = pointsUniOther->at( index )[j];
341 Teuchos::ArrayRCP< SC > dataOther = mvLocalOther->getDataNonConst( dim );
342 for (
int i=0; i<dataOther.size(); i++)
343 dataOther[i] = indexGlobalCommOther[i];
346 MultiVectorPtr_Type mvGlobalThis;
347 MultiVectorPtr_Type mvGlobalOther;
349 mvGlobalThis = Teuchos::rcp(
new MultiVector_Type( mapAllThis, dim + 1 ) );
350 mvGlobalOther = Teuchos::rcp(
new MultiVector_Type( mapAllOther, dim + 1 ) );
352 mvGlobalThis->exportFromVector( mvLocalThis,
true,
"Insert",
"Reverse" );
353 mvGlobalOther->exportFromVector( mvLocalOther,
true,
"Insert",
"Reverse" );
359 vec_int_Type indexThis( numInterfaceGlobalThis );
360 vec_int_Type indexOther( numInterfaceGlobalThis );
361 std::iota ( std::begin( indexThis ), std::end( indexThis ), 0 );
362 std::iota ( std::begin( indexOther ), std::end( indexOther ), 0 );
364 vec2D_dbl_Type pointThis( numInterfaceGlobalThis, vec_dbl_Type(dim) );
365 vec2D_dbl_Type pointOther( numInterfaceGlobalThis, vec_dbl_Type(dim) );
367 vec_GO_Type indexGlobalThis( numInterfaceGlobalThis );
368 vec_GO_Type indexGlobalOther( numInterfaceGlobalThis );
373 Teuchos::ArrayRCP< const SC > dataX = mvGlobalThis->getData(0);
374 Teuchos::ArrayRCP< const SC > dataY = mvGlobalThis->getData(1);
375 Teuchos::ArrayRCP< const SC > dataZ;
376 Teuchos::ArrayRCP< const SC > dataGlob;
378 dataZ = mvGlobalThis->getData(2);
379 dataGlob = mvGlobalThis->getData(dim);
382 dataGlob = mvGlobalThis->getData(dim);
384 for (
int i=0; i<pointThis.size(); i++) {
385 pointThis[i][0] = dataX[i];
386 pointThis[i][1] = dataY[i];
388 pointThis[i][2] = dataZ[i];
389 indexGlobalThis[i] = (GO) dataGlob[i] + eps100;
393 Teuchos::ArrayRCP< const SC > dataX = mvGlobalOther->getData(0);
394 Teuchos::ArrayRCP< const SC > dataY = mvGlobalOther->getData(1);
395 Teuchos::ArrayRCP< const SC > dataZ;
396 Teuchos::ArrayRCP< const SC > dataGlob;
398 dataZ = mvGlobalOther->getData(2);
399 dataGlob = mvGlobalOther->getData(dim);
402 dataGlob = mvGlobalOther->getData(dim);
404 for (
int i=0; i<pointOther.size(); i++) {
405 pointOther[i][0] = dataX[i];
406 pointOther[i][1] = dataY[i];
408 pointOther[i][2] = dataZ[i];
409 indexGlobalOther[i] = (GO) dataGlob[i] + eps100;
414 sort(indexThis.begin(), indexThis.end(),
415 [&](
const int& a,
const int& b) {
416 return pointThis[a] < pointThis[b];
420 sort(indexOther.begin(), indexOther.end(),
421 [&](
const int& a,
const int& b) {
422 return pointOther[a] < pointOther[b];
426 indexGlobalThis = sort_from_ref(indexGlobalThis, indexThis);
427 indexGlobalOther = sort_from_ref(indexGlobalOther, indexOther);
430 indicesGlobalMatched_->at(flagIndex).at(0) = indexGlobalThis;
431 indicesGlobalMatched_->at(flagIndex).at(1) = indexGlobalOther;
434 indicesGlobalMatchedOrigin_->at(flagIndex).at(0) = indexGlobalThis;
435 indicesGlobalMatchedOrigin_->at(flagIndex).at(1) = indexGlobalOther;
438 calculateDistancesToInterfaceParallel( distancesToInterface, pointThis, pointsRepThis );
443template <
class SC,
class LO,
class GO,
class NO>
444void MeshInterface<SC,LO,GO,NO>::calculateDistancesToInterfaceParallel( vec_dbl_ptr_Type &distancesToInterface, vec2D_dbl_Type &pointThis, vec2D_dbl_ptr_Type sourceNodesRep )
448 if (pointThis.size() > 0)
449 dim = pointThis[0].size();
455 vec3D_GO_ptr_Type indicesGlobalMatched = this->indicesGlobalMatched_;
464 int numberInterfaceNodes = indicesGlobalMatched->at(0).at(0).size();
467 vec2D_dbl_ptr_Type endNodesRep = Teuchos::rcpFromRef(pointThis);
472 if ( distancesToInterface.is_null() )
473 distancesToInterface = Teuchos::rcp(
new vec_dbl_Type( sourceNodesRep->size(), 1000.0 ) );
476 double distance = 0.0;
477 for(
int i = 0; i < sourceNodesRep->size(); i++)
479 for(
int j = 0; j < endNodesRep->size(); j++)
481 for(
int k = 0; k < dim; k++)
483 distance = distance + std::pow( sourceNodesRep->at(i).at(k) - endNodesRep->at(j).at(k), 2.0 );
487 distance = std::sqrt(distance);
489 if(distancesToInterface->at(i) > distance)
490 distancesToInterface->at(i) = distance;
499template <
class SC,
class LO,
class GO,
class NO>
500void MeshInterface<SC,LO,GO,NO>::buildFromOtherInterface( Teuchos::RCP<MeshInterface> otherMeshInterface){
502 TEUCHOS_TEST_FOR_EXCEPTION( otherMeshInterface->indicesGlobalMatched_->size()<=0, std::logic_error,
"MeshInterface given is empty.");
503 TEUCHOS_TEST_FOR_EXCEPTION( otherMeshInterface->indicesGlobalMatched_->at(0).size()<=0, std::logic_error,
"MeshInterface given is empty.");
504 TEUCHOS_TEST_FOR_EXCEPTION( otherMeshInterface->isPartitioned_, std::logic_error,
"Other MeshInterface already partitioned.");
505 TEUCHOS_TEST_FOR_EXCEPTION( isPartitioned_, std::logic_error,
"This MeshInterface already partitioned.");
507 indicesGlobalMatched_.reset(
new vec3D_GO_Type( otherMeshInterface->indicesGlobalMatched_->size(), vec2D_GO_Type ( 2 , vec_GO_Type( 0 ) ) ) );
509 indicesGlobalMatchedOrigin_.reset(
new vec3D_GO_Type( otherMeshInterface->indicesGlobalMatchedOrigin_->size(), vec2D_GO_Type ( 2 , vec_GO_Type( 0 ) ) ) );
511 for (
int i=0; i<otherMeshInterface->indicesGlobalMatched_->size(); i++) {
512 indicesGlobalMatched_->at(i).at(0).resize( otherMeshInterface->indicesGlobalMatched_->at(i).at(0).size() );
513 indicesGlobalMatched_->at(i).at(1).resize( otherMeshInterface->indicesGlobalMatched_->at(i).at(1).size() );
514 indicesGlobalMatchedOrigin_->at(i).at(0).resize( otherMeshInterface->indicesGlobalMatchedOrigin_->at(i).at(0).size() );
515 indicesGlobalMatchedOrigin_->at(i).at(1).resize( otherMeshInterface->indicesGlobalMatchedOrigin_->at(i).at(1).size() );
516 for (
int j=0; j<otherMeshInterface->indicesGlobalMatched_->at(i).at(0).size(); j++) {
517 indicesGlobalMatched_->at(i).at(0).at(j) = otherMeshInterface->indicesGlobalMatched_->at(i).at(1).at(j);
518 indicesGlobalMatched_->at(i).at(1).at(j) = otherMeshInterface->indicesGlobalMatched_->at(i).at(0).at(j);
520 indicesGlobalMatchedOrigin_->at(i).at(0).at(j) = otherMeshInterface->indicesGlobalMatchedOrigin_->at(i).at(1).at(j);
521 indicesGlobalMatchedOrigin_->at(i).at(1).at(j) = otherMeshInterface->indicesGlobalMatchedOrigin_->at(i).at(0).at(j);
527template <
class SC,
class LO,
class GO,
class NO>
528void MeshInterface<SC,LO,GO,NO>::print(CommConstPtr_Type comm){
530 for (
int i=0; i<indicesGlobalMatched_->size(); i++) {
531 for (
int j=0; j<indicesGlobalMatched_->at(i).at(0).size(); j++) {
532 std::cout << comm->getRank()<<
" Matched IDs for flag " << i <<
" :" << indicesGlobalMatched_->at(i).at(0).at(j) <<
" - " << indicesGlobalMatched_->at(i).at(0).at(j) << std::endl;
537template <
class SC,
class LO,
class GO,
class NO>
538typename MeshInterface<SC,LO,GO,NO>::vec3D_GO_ptr_Type MeshInterface<SC,LO,GO,NO>::getIndicesGlobalMatched(){
539 return indicesGlobalMatched_;
542template <
class SC,
class LO,
class GO,
class NO>
543typename MeshInterface<SC,LO,GO,NO>::vec3D_GO_ptr_Type MeshInterface<SC,LO,GO,NO>::getIndicesGlobalMatchedOrigin()
545 return indicesGlobalMatchedOrigin_;
548template <
class SC,
class LO,
class GO,
class NO>
549typename MeshInterface<SC,LO,GO,NO>::vec3D_GO_ptr_Type MeshInterface<SC,LO,GO,NO>::getIndicesGlobalMatchedUnique()
551 return indicesGlobalMatchedUnique_;
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5