Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QualityImprover/VertexMover/LaplacianSmoothers/LaplacianSmoother.cpp
Go to the documentation of this file.
1 /* *****************************************************************
2  MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4  Copyright 2004 Sandia Corporation and Argonne National
5  Laboratory. Under the terms of Contract DE-AC04-94AL85000
6  with Sandia Corporation, the U.S. Government retains certain
7  rights in this software.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  (lgpl.txt) along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 
23  diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
24  pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
25 
26  ***************************************************************** */
38 #include "LaplacianSmoother.hpp"
39 #include "LPtoPTemplate.hpp"
40 #include "EdgeLengthQualityMetric.hpp"
41 
42 
43 namespace Mesquite {
44 
45 
47 {
48  this->set_name("LaplacianSmoother");
49 
51 
54  objFunc = new LPtoPTemplate(edgeQM, 2, err);MSQ_ERRRTN(err);
55 
56 }
57 
59 {
60  delete edgeQM;
61  delete objFunc;
62 }
63 
64 
66 {
67 
68 }
69 
70 
72  MsqError &/*err*/)
73 {
74  // cout << "- Executing LaplacianSmoother::iteration_complete()\n";
75 }
76 
77 
84  MsqError &err)
85 {
86  //default the laplacian smoother to 3 even for 2-d elements.
87  //int dim = get_mesh_set()->space_dim();
88  size_t dim = 3;
89 
90 
91  // does the Laplacian smoothing
92  MsqFreeVertexIndexIterator free_iter(&pd, err); MSQ_ERRRTN(err);
93  free_iter.reset();
94  free_iter.next();
95  //m is the free vertex.
96  size_t m=free_iter.value();
97  msq_std::vector<size_t> vert_indices;
98  vert_indices.reserve(25);
99  //get vertices adjacent to vertex m
100  pd.get_adjacent_vertex_indices(m,vert_indices,err); MSQ_ERRRTN(err);
101  //move vertex m
102  centroid_smooth_mesh(pd, vert_indices.size(), vert_indices,
103  m, dim, err); MSQ_ERRRTN(err);
104  //snap vertex m to domain
105  pd.snap_vertex_to_domain(m,err);
106 
107 }
108 
110  MsqError &/*err*/)
111 {
112  // cout << "- Executing LaplacianSmoother::iteration_complete()\n";
113 }
114 
116 {
117  // cout << "- Executing LaplacianSmoother::iteration_end()\n";
118 }
119 
120 } // namespace Mesquite
121 
void set_averaging_method(AveragingMethod method, MsqError &err)
size_t value()
Returns an index corresponding to a free vertex.
virtual void set_patch_type(PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
Sets the Patch Type.
Calculates the L_p objective function raised to the pth power. That is, sums the p_th powers of (the ...
Used to hold the error state and return it to the application.
void set_name(msq_std::string name)
provides a name to the QualityImprover (use it in constructor).
bool next()
Increments the iterator. returns false if there is no more free vertex.
Computes the lengths of the edges connected to given a vertex..
void snap_vertex_to_domain(size_t vertex_index, MsqError &err)
Adjust the position of the specified vertex so that it lies on its constraining domain.
void get_adjacent_vertex_indices(size_t vertex_index, msq_std::vector< size_t > &vert_indices, MsqError &err)
iterates over indexes of free vetices in a PatchData.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
void centroid_smooth_mesh(PatchData &pd, size_t num_adj_vtx, msq_std::vector< size_t > adj_vtx_ind, size_t free_ind, size_t dimension, MsqError &err)