Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TargetCalculator/WTargetCalculator.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  ***************************************************************** */
27 
37 #include "WTargetCalculator.hpp"
38 #include "PatchDataUser.hpp"
39 #include "MeshSet.hpp"
40 #include "MsqTimer.hpp"
41 
42 using namespace Mesquite;
43 
44 
45 
49 {
50  MSQ_FUNCTION_TIMER( "WTargetCalculator::compute_target_matrice" );
51 
52  size_t num_elements=pd.num_elements();
53 
54  PatchData ref_pd, *ref_pd_ptr;
55  if ( refMesh != 0 ) {
56  // If there is a reference mesh, gets a patch ref_pd equivalent to the patch pd of the main mesh.
57  PatchDataParameters ref_pd_params(this->get_all_parameters());
58  refMesh->get_next_patch(ref_pd, ref_pd_params, err); MSQ_ERRRTN(err);
59  // Make sure topology of ref_pd and pd are equal
60  assert( num_elements == ref_pd.num_elements() );
61  size_t num_vertices=pd.num_vertices();
62  assert( num_vertices == ref_pd.num_vertices() );
63  ref_pd_ptr = &ref_pd;
64  }
65  else {
66  // the reference patch is the same as the working patch if there is no reference mesh.
67  ref_pd_ptr = &pd;
68  }
69 
70  MsqMeshEntity* elems = pd.get_element_array(err); MSQ_ERRRTN(err);
71  MsqMeshEntity* elems_ref = ref_pd_ptr->get_element_array(err); MSQ_ERRRTN(err);
72 
75 
76  for (size_t i=0; i<num_elements; ++i) {
77  int nve = elems[i].vertex_count();
78  assert( nve = elems_ref[i].vertex_count() );
79 
80  compute_guide_matrices(guideMatrix, *ref_pd_ptr, i, W_guides, nve, err); MSQ_ERRRTN(err);
81  for (int c = 0; c < nve; ++c)
82  matrices[c] = W_guides[c];
83  pd.targetMatrices.set_element_corner_tags( &pd, i, matrices, err ); MSQ_ERRRTN(err);
84  }
85 
86  //if ( refMesh != 0 ) delete ref_pd;
87 }
88 
CornerTag< TargetMatrix > targetMatrices
Target matrix data.
Used to hold the error state and return it to the application.
PatchDataParameters & get_all_parameters()
Returns the PatchDataParameters object.
void compute_guide_matrices(enum guide_type type, PatchData &ref_pd, size_t elem_ind, Matrix3D A[], int num, MsqError &err)
Computes the guide corner matrices A for a given element index in the reference patch.
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
size_t num_elements() const
number of elements in the Patch.
msq_stdc::size_t vertex_count() const
Returns the number of vertices in this element, based on its element type.
virtual void compute_target_matrices(PatchData &pd, MsqError &err)
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
blockLoc i
Definition: read.cpp:79
size_t num_vertices() const
number of vertices in the patch.
Class containing the target corner matrices for the context based smoothing.
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
bool get_next_patch(PatchData &pd, PatchDataUser *pd_user, MsqError &err)
Gets the next PatchData.