Commit 475115c3 authored by Jan Möbius's avatar Jan Möbius
Browse files

Indentations



git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@690 fdac6126-5c0c-442c-9429-916003d36597
parent b66988ac
...@@ -114,6 +114,7 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) { ...@@ -114,6 +114,7 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
unsigned int noCollapses = 0; unsigned int noCollapses = 0;
while ( n_collapses < _n_collapses) { while ( n_collapses < _n_collapses) {
if (noCollapses > 20) { if (noCollapses > 20) {
omlog() << "[McDecimater] : no collapses performed in over 20 iterations in a row\n"; omlog() << "[McDecimater] : no collapses performed in over 20 iterations in a row\n";
break; break;
...@@ -126,9 +127,9 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) { ...@@ -126,9 +127,9 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
double energy = FLT_MAX; double energy = FLT_MAX;
// Generate random samples for collapses // Generate random samples for collapses
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp parallel for private(energy,tmpHandle) shared(bestEnergy,bestHandle) #pragma omp parallel for private(energy,tmpHandle) shared(bestEnergy,bestHandle)
#endif #endif
for ( int i = 0; i < (int)randomSamples_; ++i) { for ( int i = 0; i < (int)randomSamples_; ++i) {
// Random halfedge handle // Random halfedge handle
...@@ -141,22 +142,22 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) { ...@@ -141,22 +142,22 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
// Check if legal we analyze the priority of this collapse operation // Check if legal we analyze the priority of this collapse operation
if (this->is_collapse_legal(ci)) { if (this->is_collapse_legal(ci)) {
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp critical(energyUpdate) #pragma omp critical(energyUpdate)
{ {
#endif #endif
energy = this->collapse_priority(ci); energy = this->collapse_priority(ci);
if (energy != ModBaseT<Mesh>::ILLEGAL_COLLAPSE) { if (energy != ModBaseT<Mesh>::ILLEGAL_COLLAPSE) {
// Check if the current samples energy is better than any energy before // Check if the current samples energy is better than any energy before
if ( energy < bestEnergy ) { if ( energy < bestEnergy ) {
bestEnergy = energy; bestEnergy = energy;
bestHandle = tmpHandle; bestHandle = tmpHandle;
}
} }
#ifdef USE_OPENMP
} }
#ifdef USE_OPENMP #endif
}
#endif
} else { } else {
continue; continue;
} }
...@@ -235,7 +236,7 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) { ...@@ -235,7 +236,7 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
// performed in a row // performed in a row
unsigned int noCollapses = 0; unsigned int noCollapses = 0;
while ( (_nv < nv) && (_nf < nf) ) { while ((_nv < nv) && (_nf < nf)) {
if (noCollapses > 20) { if (noCollapses > 20) {
omlog() << "[McDecimater] : no collapses performed in over 20 iterations in a row\n"; omlog() << "[McDecimater] : no collapses performed in over 20 iterations in a row\n";
break; break;
...@@ -247,39 +248,38 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) { ...@@ -247,39 +248,38 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
double bestEnergy = FLT_MAX; double bestEnergy = FLT_MAX;
double energy = FLT_MAX; double energy = FLT_MAX;
// Generate random samples for collapses // Generate random samples for collapses
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp parallel for private(energy,tmpHandle) shared(bestEnergy,bestHandle) #pragma omp parallel for private(energy,tmpHandle) shared(bestEnergy,bestHandle)
#endif #endif
for ( int i = 0; i < (int)randomSamples_; ++i) { for (int i = 0; i < (int) randomSamples_; ++i) {
// Random halfedge handle // Random halfedge handle
tmpHandle = typename Mesh::HalfedgeHandle((static_cast<double>(rand()) / RAND_MAX) * (mesh_.n_halfedges()-1) ); tmpHandle = typename Mesh::HalfedgeHandle((static_cast<double>(rand()) / RAND_MAX) * (mesh_.n_halfedges() - 1));
// if it is not deleted, we analyse it // if it is not deleted, we analyse it
if ( ! mesh_.status(tmpHandle).deleted() ) { if (!mesh_.status(tmpHandle).deleted()) {
CollapseInfo ci(mesh_, tmpHandle); CollapseInfo ci(mesh_, tmpHandle);
// Check if legal we analyze the priority of this collapse operation // Check if legal we analyze the priority of this collapse operation
if (this->is_collapse_legal(ci)) { if (this->is_collapse_legal(ci)) {
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp critical(energyUpdate) #pragma omp critical(energyUpdate)
{ {
#endif #endif
energy = this->collapse_priority(ci); energy = this->collapse_priority(ci);
if (energy != ModBaseT<Mesh>::ILLEGAL_COLLAPSE) { if (energy != ModBaseT<Mesh>::ILLEGAL_COLLAPSE) {
// Check if the current samples energy is better than any energy before // Check if the current samples energy is better than any energy before
if ( energy < bestEnergy ) { if (energy < bestEnergy) {
bestEnergy = energy; bestEnergy = energy;
bestHandle = tmpHandle; bestHandle = tmpHandle;
}
} }
} #ifdef USE_OPENMP
#ifdef USE_OPENMP
} }
#endif #endif
} else { } else {
continue; continue;
} }
...@@ -374,7 +374,7 @@ size_t McDecimaterT<Mesh>::decimate_constraints_only(float _factor) { ...@@ -374,7 +374,7 @@ size_t McDecimaterT<Mesh>::decimate_constraints_only(float _factor) {
unsigned int noCollapses = 0; unsigned int noCollapses = 0;
while ( (noCollapses <= 20) && (illegalCollapses <= 10) && (nv > 0) && (nf > 1) ) { while ((noCollapses <= 20) && (illegalCollapses <= 10) && (nv > 0) && (nf > 1)) {
// Optimal id and value will be collected during the random sampling // Optimal id and value will be collected during the random sampling
typename Mesh::HalfedgeHandle bestHandle(-1); typename Mesh::HalfedgeHandle bestHandle(-1);
...@@ -383,48 +383,48 @@ size_t McDecimaterT<Mesh>::decimate_constraints_only(float _factor) { ...@@ -383,48 +383,48 @@ size_t McDecimaterT<Mesh>::decimate_constraints_only(float _factor) {
double energy = FLT_MAX; double energy = FLT_MAX;
// Generate random samples for collapses // Generate random samples for collapses
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp parallel for private(energy,tmpHandle) shared(bestEnergy,bestHandle) #pragma omp parallel for private(energy,tmpHandle) shared(bestEnergy,bestHandle)
#endif #endif
for ( int i = 0; i < (int)randomSamples_; ++i) { for (int i = 0; i < (int) randomSamples_; ++i) {
// Random halfedge handle // Random halfedge handle
tmpHandle = typename Mesh::HalfedgeHandle((static_cast<double>(rand()) / RAND_MAX) * (mesh_.n_halfedges()-1) ); tmpHandle = typename Mesh::HalfedgeHandle((static_cast<double>(rand()) / RAND_MAX) * (mesh_.n_halfedges() - 1));
// if it is not deleted, we analyse it // if it is not deleted, we analyse it
if ( ! mesh_.status(tmpHandle).deleted() ) { if (!mesh_.status(tmpHandle).deleted()) {
CollapseInfo ci(mesh_, tmpHandle); CollapseInfo ci(mesh_, tmpHandle);
// Check if legal we analyze the priority of this collapse operation // Check if legal we analyze the priority of this collapse operation
if (this->is_collapse_legal(ci)) { if (this->is_collapse_legal(ci)) {
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp critical(energyUpdate) #pragma omp critical(energyUpdate)
{ {
#endif #endif
energy = this->collapse_priority(ci); energy = this->collapse_priority(ci);
if (energy == ModBaseT<Mesh>::ILLEGAL_COLLAPSE){ if (energy == ModBaseT<Mesh>::ILLEGAL_COLLAPSE) {
if (lastCollapseIllegal) { if (lastCollapseIllegal) {
illegalCollapses++; illegalCollapses++;
} else {
illegalCollapses = 1;
lastCollapseIllegal = true;
}
} else { } else {
illegalCollapses = 1; illegalCollapses = 0;
lastCollapseIllegal = true; lastCollapseIllegal = false;
// Check if the current samples energy is better than any energy before
if (energy < bestEnergy) {
bestEnergy = energy;
bestHandle = tmpHandle;
}
} }
} else { #ifdef USE_OPENMP
illegalCollapses = 0;
lastCollapseIllegal = false;
// Check if the current samples energy is better than any energy before
if ( energy < bestEnergy ) {
bestEnergy = energy;
bestHandle = tmpHandle;
}
}
#ifdef USE_OPENMP
} }
#endif #endif
} else { } else {
continue; continue;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment