Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
smooth_mesquite.C
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 #ifdef MESQUITE
24 #define USE_STD_INCLUDES 1
25 #define USE_C_PREFIX_INCLUDES 1
26 #include "Mesquite.hpp"
27 #include "MeshImpl.hpp"
28 #include "MesquiteError.hpp"
29 #include "InstructionQueue.hpp"
30 #include "MeshSet.hpp"
31 #include "TerminationCriterion.hpp"
32 #include "QualityAssessor.hpp"
33 #include "PlanarDomain.hpp"
34 #include "ShapeImprovementWrapper.hpp"
35 
36 // algorithms
37 #include "MeanRatioQualityMetric.hpp"
38 #include "EdgeLengthQualityMetric.hpp"
39 #include "LPtoPTemplate.hpp"
40 #include "FeasibleNewton.hpp"
41 #include "ConjugateGradient.hpp"
42 #include "MsqMessage.hpp"
43 #include "MesqPane.h"
44 
45 using namespace Mesquite;
46 #endif
47 
48 #include "Rocmop.h"
49 #include "roccom.h"
50 #include "Pane.h"
51 #include "Rocblas.h"
52 #include "Rocmap.h"
53 #include "Geometric_Metrics_3.h"
54 
56 
57 using MAP::Rocmap;
58 
59 void Rocmop::smooth_vol_mesq_wg(double initial_quality){
60  if(_verb)
61  std::cout << " Entering Rocmop::smooth_vol_mesq_wg" << std::endl;
62 
63  std::vector<COM::Pane*> allpanes;
64  _wrk_window->panes(allpanes);
65  int total_npanes = (int)allpanes.size();
66 
67  // Get the worst dihedral angle of all of the elements
68  double pre_worst = initial_quality, post_worst = 180.0;
69  double pre_worst_all = 180.0;
70  double post_worst_all = 0.0;
71  int to_cycle = 1;
72 
73  //std::string msg("\n Initial shared quality = ");
74  //print_mquality(msg, _is_shared_node);
75 
76  for(int i=0; (i<_ncycle && to_cycle); ++i){
77  if(_verb > 2)
78  std::cout << " Subcycle " << i << std::endl;
79 
80  // smooth the panes via MESQUITE with ghosts.
81  smooth_mesquite(allpanes,1);
82 
83  //msg = "\n Post-mesquite quality = ";
84  //print_mquality(msg, _is_shared_node);
85 
86  //msg = "\n Post-mesquite all quality = ";
87  //print_quality(msg);
88 
89  //get the worst quality of all the shared elements
90  pre_worst = check_marked_elem_quality(_is_shared_elem,allpanes);
91 
92  if(_verb > 2)
93  std::cout << " Updating shared and ghost node positions.\n";
94  Rocmap::reduce_average_on_shared_nodes(_wrk_window->attribute(COM::COM_NC));
95  Rocmap::update_ghosts(_wrk_window->attribute(COM::COM_NC),
96  _wrk_window->attribute(COM::COM_PCONN));
97 
98  //msg = "\n Post-communicated quality = ";
99  //print_mquality(msg, _is_shared_node);
100 
101  //msg = "\n Post-communicated all quality = ";
102  //print_quality(msg);
103 
104  if(_ctol != 0.0){
105  post_worst = check_marked_elem_quality(_is_shared_elem,allpanes);
106  if(pre_worst/post_worst > _ctol)
107  to_cycle = 0;
108  }
109  agree_int(to_cycle, MPI_MAX);
110  }
111 
112  if(_verb > 1)
113  std::cout << " Exiting Rocmop::smooth_vol_mesq_wg" << std::endl;
114 }
115 
117 
118 
119 
120 
121 
122 
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
Contains the prototypes for the Pane object.
This file contains the prototypes for Roccom API.
3D geometric quality Metric declarations.
void smooth_vol_mesq_wg()
Smooth a volume via Mesquite using ghost information.
const int total_npanes
Definition: ex1.C:94
blockLoc i
Definition: read.cpp:79
#define MOP_END_NAMESPACE
Definition: mopbasic.h:29
Definition for Rocblas API.
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
Definition: Rocmap.C:87
MesqPane.h.
static void reduce_average_on_shared_nodes(COM::Attribute *att, COM::Attribute *pconn=NULL)
Perform an average-reduction on the shared nodes for the given attribute.
Definition: Rocmap.C:57
#define MOP_BEGIN_NAMESPACE
Definition: mopbasic.h:28