vtf-logo

optimize.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__geom_mesh_iss_optimize_h__)
00009 #define __geom_mesh_iss_optimize_h__
00010 
00011 #include "IndSimpSetIncAdj.h"
00012 #include "accessors.h"
00013 #include "geometry.h"
00014 #include "PointsOnManifold.h"
00015 
00016 #include "../simplex/ComplexWithFreeVertexOnManifold.h"
00017 #include "../simplex/SimplexModMeanRatio.h"
00018 #include "../simplex/SimplexModCondNum.h"
00019 
00020 #include "../../kernel/ParametrizedLine.h"
00021 #include "../../kernel/ParametrizedPlane.h"
00022 
00023 #include "../../../ads/functor/Identity.h"
00024 #include "../../../ads/iterator/IntIterator.h"
00025 
00026 #include "../../../numerical/optimization/QuasiNewton.h"
00027 #include "../../../numerical/optimization/PenaltyQuasiNewton.h"
00028 #include "../../../numerical/optimization/Simplex.h"
00029 
00030 BEGIN_NAMESPACE_GEOM
00031 
00032 //-----------------------------------------------------------------------------
00040 
00041 
00042 
00043 //-------------------------------------------------------------------------
00044 // Interior
00045 //-------------------------------------------------------------------------
00046 
00047 
00049 
00057 template<template<int,typename> class QF, 
00058          int N, bool A, typename T, typename V, typename IS>
00059 void
00060 geometricOptimizeInterior
00061 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, int numSweeps = 1);
00062 
00063 
00064 
00066 
00076 template<template<int,typename> class QF, 
00077          int N, bool A, typename T, typename V, typename IS, 
00078          typename IntForIter>
00079 void
00080 geometricOptimizeInterior(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00081                           IntForIter begin, IntForIter end, 
00082                           int numSweeps = 1);
00083 
00084 
00086 
00094 template<int N, bool A, typename T, typename V, typename IS>
00095 void
00096 geometricOptimizeInteriorUsingMeanRatio
00097 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, const int numSweeps = 1) {
00098   geometricOptimizeInterior<SimplexModMeanRatio>(mesh, numSweeps);
00099 }
00100 
00101 
00103 
00111 template<int N, bool A, typename T, typename V, typename IS>
00112 void
00113 geometricOptimizeInteriorUsingConditionNumber
00114 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00115  const int numSweeps = 1) {
00116   geometricOptimizeInterior<SimplexModCondNum>(mesh, numSweeps);
00117 }
00118 
00119 
00120 
00121 
00122 //-------------------------------------------------------------------------
00123 // Boundary
00124 //-------------------------------------------------------------------------
00125 
00126 
00128 
00137 template<template<int,typename> class QF, 
00138          int N, bool A, typename T, typename V, typename IS, int SD>
00139 void
00140 geometricOptimizeBoundary(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00141                           PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00142                           int numSweeps = 1);
00143 
00144 
00145 
00147 
00158 template<template<int,typename> class QF, 
00159          bool A, typename T, typename V, typename IS, 
00160          typename IntForIter, int SD>
00161 void
00162 geometricOptimizeBoundary(IndSimpSetIncAdj<2,2,A,T,V,IS>* mesh, 
00163                           IntForIter begin, IntForIter end, 
00164                           PointsOnManifold<2,1,SD,T>* boundaryManifold,
00165                           int numSweeps = 1);
00166 
00167 
00169 
00178 template<int N, bool A, typename T, typename V, typename IS, int SD>
00179 void
00180 geometricOptimizeBoundaryUsingMeanRatio
00181 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00182  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00183  const int numSweeps = 1) {
00184   geometricOptimizeBoundary<SimplexModMeanRatio>
00185     (mesh, boundaryManifold, numSweeps);
00186 }
00187 
00188 
00190 
00199 template<int N, bool A, typename T, typename V, typename IS, int SD>
00200 void
00201 geometricOptimizeBoundaryUsingConditionNumber
00202 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00203  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00204  const int numSweeps = 1) {
00205   geometricOptimizeBoundary<SimplexModCondNum>
00206     (mesh, boundaryManifold, numSweeps);
00207 }
00208 
00209 
00210 
00211 
00212 //-------------------------------------------------------------------------
00213 // Mixed
00214 //-------------------------------------------------------------------------
00215 
00216 
00217 
00219 
00229 template<template<int,typename> class QF, 
00230          int N, bool A, typename T, typename V, typename IS, int SD>
00231 void
00232 geometricOptimize(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00233                   PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00234                   int numSweeps = 1);
00235 
00236 
00237 
00239 
00249 template<int N, bool A, typename T, typename V, typename IS, int SD>
00250 void
00251 geometricOptimizeUsingMeanRatio
00252 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00253  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00254  const int numSweeps = 1) {
00255   geometricOptimize<SimplexModMeanRatio>(mesh, boundaryManifold, numSweeps);
00256 }
00257 
00258 
00260 
00270 template<int N, bool A, typename T, typename V, typename IS, int SD>
00271 void
00272 geometricOptimizeUsingConditionNumber
00273 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00274  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00275  const int numSweeps = 1) {
00276   geometricOptimize<SimplexModCondNum>(mesh, boundaryManifold, numSweeps);
00277 }
00278 
00279 
00280 
00281 
00282 //-------------------------------------------------------------------------
00283 // Other methods.
00284 //-------------------------------------------------------------------------
00285 
00286 
00287 
00289 
00298 template<template<int,typename> class QF, 
00299          int N, bool A, typename T, typename V, typename IS, int SD>
00300 void
00301 geometricOptimizeWithBoundaryCondition
00302 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00303  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00304  int numSweeps = 1);
00305 
00306 
00307 
00309 
00318 template<int N, bool A, typename T, typename V, typename IS, int SD>
00319 void
00320 geometricOptimizeWithBoundaryConditionUsingMeanRatio
00321 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00322  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00323  const int numSweeps = 1) {
00324   geometricOptimizeWithBoundaryCondition<SimplexModMeanRatio>
00325     (mesh, boundaryManifold, numSweeps);
00326 }
00327 
00328 
00330 
00339 template<int N, bool A, typename T, typename V, typename IS, int SD>
00340 void
00341 geometricOptimizeWithBoundaryConditionUsingConditionNumber
00342 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00343  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00344  const int numSweeps = 1) {
00345   geometricOptimizeWithBoundaryCondition<SimplexModCondNum>
00346     (mesh, boundaryManifold, numSweeps);
00347 }
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00359 
00368 template<template<int,typename> class QF, 
00369           int N, bool A, typename T, typename V, typename IS, 
00370           class BoundaryCondition>
00371 void
00372 geometricOptimizeWithCondition(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00373                                const BoundaryCondition& condition,
00374                                int numSweeps = 1);
00375 
00377 
00386 template<int N, bool A, typename T, typename V, typename IS, 
00387           class BoundaryCondition>
00388 inline
00389 void
00390 geometricOptimizeWithConditionUsingMeanRatio
00391 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh,
00392  const BoundaryCondition& condition,
00393  const int numSweeps = 1) {
00394   geometricOptimizeWithCondition<SimplexModMeanRatio>
00395     (mesh, condition, numSweeps);
00396 }
00397 
00399 
00408 template<int N, bool A, typename T, typename V, typename IS, 
00409          class BoundaryCondition>
00410 inline
00411 void
00412 geometricOptimizeWithConditionUsingConditionNumber
00413 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh,
00414  const BoundaryCondition& condition,
00415  const int numSweeps = 1) {
00416   geometricOptimizeWithCondition<SimplexModCondNum>
00417     (mesh, condition, numSweeps);
00418 }
00419 
00420 
00421 
00422 
00424 
00432 template<template<int,typename> class QF, 
00433          int N, bool A, typename T, typename V, typename IS>
00434 inline
00435 void
00436 geometricOptimize(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00437                   const int numSweeps = 1) {
00438   geometricOptimizeWithCondition<QF>(mesh, ads::identity<V>(), numSweeps);
00439 }
00440 
00441 
00443 
00451 template<int N, bool A, typename T, typename V, typename IS>
00452 inline
00453 void
00454 geometricOptimizeUsingMeanRatio(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh,
00455                                 const int numSweeps = 1) {
00456   geometricOptimize<SimplexModMeanRatio>(mesh, numSweeps);
00457 }
00458 
00460 
00468 template<int N, bool A, typename T, typename V, typename IS>
00469 inline
00470 void
00471 geometricOptimizeUsingConditionNumber(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh,
00472                                       const int numSweeps = 1) {
00473   geometricOptimize<SimplexModCondNum>(mesh, numSweeps);
00474 }
00475 
00476 
00477 
00478 
00479 
00480 
00481 
00482 
00483 
00484 
00485 
00487 
00498 template<template<int,typename> class QF, 
00499          int N, bool A, typename T, typename V, typename IS, 
00500          typename IntForIter, int SD>
00501 void
00502 geometricOptimizeWithBoundaryCondition(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00503                                        IntForIter begin, IntForIter end, 
00504                                        PointsOnManifold<N,N-1,SD,T>* 
00505                                        boundaryManifold,
00506                                        int numSweeps = 1);
00507 
00508 
00510 
00522 template<int N, bool A, typename T, typename V, typename IS, 
00523          typename IntForIter, int SD>
00524 inline
00525 void
00526 geometricOptimizeWithBoundaryConditionUsingMeanRatio
00527 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00528  IntForIter begin, IntForIter end, 
00529  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00530  const int numSweeps = 1) { 
00531   geometricOptimizeWithBoundaryCondition<SimplexModMeanRatio>
00532     (mesh, begin, end, boundaryManifold, numSweeps);
00533 }
00534 
00535 
00537 
00549 template<int N, bool A, typename T, typename V, typename IS, 
00550          typename IntForIter, int SD>
00551 inline
00552 void
00553 geometricOptimizeWithBoundaryConditionUsingConditionNumber
00554 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00555  IntForIter begin, IntForIter end, 
00556  PointsOnManifold<N,N-1,SD,T>* boundaryManifold,
00557  const int numSweeps = 1) { 
00558   geometricOptimizeWithBoundaryCondition<SimplexModCondNum>
00559     (mesh, begin, end, boundaryManifold, numSweeps);
00560 }
00561 
00562 
00563 
00564 
00565 
00566 
00567 
00568 
00569 
00570 
00572 
00583 template<template<int,typename> class QF, 
00584          int N, bool A, typename T, typename V, typename IS, 
00585          typename IntForIter, class BoundaryCondition>
00586 void
00587 geometricOptimizeWithCondition(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00588                                IntForIter begin, IntForIter end, 
00589                                const BoundaryCondition& condition,
00590                                int numSweeps = 1);
00591 
00593 
00605 template<int N, bool A, typename T, typename V, typename IS, 
00606           typename IntForIter, class BoundaryCondition>
00607 inline
00608 void
00609 geometricOptimizeWithConditionUsingMeanRatio
00610 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00611  IntForIter begin, IntForIter end, 
00612  const BoundaryCondition& condition,
00613  int numSweeps = 1) { 
00614   geometricOptimizeWithCondition<SimplexModMeanRatio>(mesh, begin, end, 
00615                                                       condition, numSweeps);
00616 }
00617 
00619 
00631 template<int N, bool A, typename T, typename V, typename IS, 
00632          typename IntForIter, class BoundaryCondition>
00633 inline
00634 void
00635 geometricOptimizeWithConditionUsingConditionNumber
00636 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00637  IntForIter begin, IntForIter end, 
00638  const BoundaryCondition& condition,
00639  const int numSweeps = 1) {
00640   geometricOptimizeWithCondition<SimplexModCondNum>(mesh, begin, end, 
00641                                                     condition, numSweeps);
00642 }
00643 
00644 
00645 
00646 
00647 
00648 
00650 
00660 template<template<int,typename> class QF, 
00661          int N, bool A, typename T, typename V, typename IS, 
00662          typename IntForIter>
00663 void
00664 geometricOptimize(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00665                   IntForIter begin, IntForIter end, const int numSweeps = 1) {
00666   geometricOptimizeWithCondition<QF>(mesh, begin, end, ads::identity<V>(), 
00667                                      numSweeps);
00668 }
00669 
00671 
00682 template<int N, bool A, typename T, typename V, typename IS, 
00683          typename IntForIter>
00684 inline
00685 void
00686 geometricOptimizeUsingMeanRatio(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00687                                 IntForIter begin, IntForIter end, 
00688                                 const int numSweeps = 1) { 
00689   geometricOptimize<SimplexModMeanRatio>(mesh, begin, end, numSweeps);
00690 }
00691 
00693 
00704 template<int N, bool A, typename T, typename V, typename IS, 
00705          typename IntForIter>
00706 inline
00707 void
00708 geometricOptimizeUsingConditionNumber(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00709                                       IntForIter begin, IntForIter end, 
00710                                       const int numSweeps = 1) {
00711   geometricOptimize<SimplexModCondNum>(mesh, begin, end, numSweeps);
00712 }
00713 
00714 
00715 
00716 
00717 
00718 
00720 
00732 template<template<int,typename> class QF, 
00733          int N, bool A, typename T, typename V, typename IS, 
00734          typename IntForIter, class BoundaryCondition>
00735 void
00736 geometricOptimizeWithConditionConstrained
00737 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00738  IntForIter begin, IntForIter end, 
00739  const BoundaryCondition& condition,
00740  const T maxConstraintError,
00741  int numSweeps = 1);
00742 
00744 
00757 template<int N, bool A, typename T, typename V, typename IS, 
00758          typename IntForIter, class BoundaryCondition>
00759 inline
00760 void
00761 geometricOptimizeWithConditionConstrainedUsingMeanRatio
00762 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00763  IntForIter begin, IntForIter end, 
00764  const BoundaryCondition& condition,
00765  const T maxConstraintError,
00766  int numSweeps = 1) {
00767   geometricOptimizeWithConditionConstrained<SimplexModMeanRatio>
00768     (mesh, begin, end, condition, maxConstraintError, numSweeps);
00769 }
00770 
00772 
00785 template<int N, bool A, typename T, typename V, typename IS, 
00786          typename IntForIter, class BoundaryCondition>
00787 inline
00788 void
00789 geometricOptimizeWithConditionConstrainedUsingConditionNumber
00790 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00791  IntForIter begin, IntForIter end, 
00792  const BoundaryCondition& condition,
00793  const T maxConstraintError,
00794  const int numSweeps = 1) {
00795   geometricOptimizeWithConditionConstrained<SimplexModCondNum>
00796     (mesh, begin, end, condition, maxConstraintError, numSweeps);
00797 }
00798 
00799 
00800 
00801 
00802 
00803 
00804 
00806 
00817 template<template<int,typename> class QF, 
00818          int N, bool A, typename T, typename V, typename IS, 
00819          typename IntForIter>
00820 inline
00821 void
00822 geometricOptimizeConstrained(IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00823                              IntForIter begin, IntForIter end, 
00824                              const T maxConstraintError,
00825                              const int numSweeps = 1) {
00826   geometricOptimizeWithConditionConstrained<QF>
00827     (mesh, begin, end, ads::identity<V>(), maxConstraintError, numSweeps);
00828 }
00829 
00831 
00843 template<int N, bool A, typename T, typename V, typename IS, 
00844           typename IntForIter>
00845 inline
00846 void
00847 geometricOptimizeConstrainedUsingMeanRatio
00848 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00849  IntForIter begin, IntForIter end, 
00850  const T maxConstraintError,
00851  const int numSweeps = 1) {
00852   geometricOptimizeConstrained<SimplexModMeanRatio>
00853     (mesh, begin, end, maxConstraintError, numSweeps);
00854 }
00855 
00857 
00869 template<int N, bool A, typename T, typename V, typename IS, 
00870          typename IntForIter>
00871 inline
00872 void
00873 geometricOptimizeConstrainedUsingConditionNumber
00874 (IndSimpSetIncAdj<N,N,A,T,V,IS>* mesh, 
00875  IntForIter begin, IntForIter end, 
00876  const T maxConstraintError,
00877  const int numSweeps = 1) {
00878   geometricOptimizeConstrained<SimplexModCondNum>
00879     (mesh, begin, end, maxConstraintError, numSweeps);
00880 }
00881 
00883 
00884 END_NAMESPACE_GEOM
00885 
00886 #define __geom_mesh_iss_optimize_ipp__
00887 #include "optimize.ipp"
00888 #undef __geom_mesh_iss_optimize_ipp__
00889 
00890 #endif

Generated on Fri Aug 24 12:55:56 2007 for Computational Geometry Package by  doxygen 1.4.7