CArl
Code Arlequin / C++ implementation
weight_parameter_function Class Reference

#include <weight_parameter_function.h>

Public Member Functions

 weight_parameter_function (libMesh::Mesh &alpha_mesh, double alpha_eps, double alpha_coupling_BIG, int subdomain_idx_BIG, int subdomain_idx_micro, int subdomain_idx_both, int subdomain_idx_coupling)
 
 weight_parameter_function (libMesh::Mesh &alpha_mesh)
 
 ~weight_parameter_function ()
 
void set_parameters (double alpha_eps, double alpha_coupling_BIG, int subdomain_idx_BIG, int subdomain_idx_micro, int subdomain_idx_both, int subdomain_idx_coupling)
 
void set_parameters (std::string &filename)
 
double get_alpha (const libMesh::Point &qpoint, WeightFunctionSystemType system_type)
 
double get_alpha_BIG (const libMesh::Point &qpoint)
 
double get_alpha_micro (const libMesh::Point &qpoint)
 
void clear ()
 

Protected Attributes

libMesh::Mesh & m_alpha_mesh
 
std::unique_ptr< libMesh::PointLocatorBase > m_locator_unique_ptr
 
double m_alpha_eps
 
double m_alpha_coupling_BIG
 
double m_alpha_coupling_micro
 
int m_subdomain_idx_BIG
 
int m_subdomain_idx_micro
 
int m_subdomain_idx_both
 
int m_subdomain_idx_coupling
 

Detailed Description

Definition at line 13 of file weight_parameter_function.h.

Constructor & Destructor Documentation

weight_parameter_function::weight_parameter_function ( libMesh::Mesh &  alpha_mesh,
double  alpha_eps,
double  alpha_coupling_BIG,
int  subdomain_idx_BIG,
int  subdomain_idx_micro,
int  subdomain_idx_both,
int  subdomain_idx_coupling 
)
inline

Definition at line 33 of file weight_parameter_function.h.

35  :
36  m_alpha_mesh{ alpha_mesh },
37  m_locator_unique_ptr { alpha_mesh.sub_point_locator() },
38  m_alpha_eps { alpha_eps },
39  m_alpha_coupling_BIG { alpha_coupling_BIG },
40  m_alpha_coupling_micro { 1. - alpha_coupling_BIG },
41  m_subdomain_idx_BIG { subdomain_idx_BIG },
42  m_subdomain_idx_micro { subdomain_idx_micro },
43  m_subdomain_idx_both { subdomain_idx_both },
44  m_subdomain_idx_coupling { subdomain_idx_coupling }
45  {
46  };
std::unique_ptr< libMesh::PointLocatorBase > m_locator_unique_ptr
weight_parameter_function::weight_parameter_function ( libMesh::Mesh &  alpha_mesh)
inline

Definition at line 48 of file weight_parameter_function.h.

48  :
49  m_alpha_mesh{ alpha_mesh },
50  m_locator_unique_ptr { alpha_mesh.sub_point_locator() },
51  m_alpha_eps { 10E-2 },
52  m_alpha_coupling_BIG { 0.5 },
53  m_alpha_coupling_micro { 0.5 },
54  m_subdomain_idx_BIG { -1 },
55  m_subdomain_idx_micro { -1 },
56  m_subdomain_idx_both { -1 },
58  {
59  };
std::unique_ptr< libMesh::PointLocatorBase > m_locator_unique_ptr
weight_parameter_function::~weight_parameter_function ( )
inline

Definition at line 62 of file weight_parameter_function.h.

63  {
64  clear();
65  }

Member Function Documentation

void weight_parameter_function::clear ( )
inline

Definition at line 207 of file weight_parameter_function.h.

208  {
209  m_locator_unique_ptr.reset(NULL);
210  };
std::unique_ptr< libMesh::PointLocatorBase > m_locator_unique_ptr
double weight_parameter_function::get_alpha ( const libMesh::Point &  qpoint,
WeightFunctionSystemType  system_type 
)
inline

Definition at line 137 of file weight_parameter_function.h.

138  {
139  switch (system_type)
140  {
142  return this->get_alpha_micro(qpoint);
143  break;
145  return this->get_alpha_BIG(qpoint);
146  break;
148  return 1.;
149  break;
150  }
151  homemade_error_msg("Why are you here!?");
152  }
#define homemade_error_msg(msg)
Definition: common_header.h:73
double get_alpha_BIG(const libMesh::Point &qpoint)
double get_alpha_micro(const libMesh::Point &qpoint)
double weight_parameter_function::get_alpha_BIG ( const libMesh::Point &  qpoint)
inline

Definition at line 154 of file weight_parameter_function.h.

155  {
156  libMesh::PointLocatorBase& locator = *m_locator_unique_ptr.get();
157  const libMesh::Elem* elem = locator(qpoint);
158  double output = 0;
159 
160  if(elem->subdomain_id() == m_subdomain_idx_BIG)
161  {
162  output = 1;
163  }
164  else if(elem->subdomain_id() == m_subdomain_idx_micro)
165  {
166  output = 0;
167  }
168  else if(elem->subdomain_id() == m_subdomain_idx_both)
169  {
170  output = m_alpha_eps;
171  }
172  else if(elem->subdomain_id() == m_subdomain_idx_coupling)
173  {
174  output = m_alpha_coupling_BIG;
175  }
176 
177  return output;
178  }
std::unique_ptr< libMesh::PointLocatorBase > m_locator_unique_ptr
double weight_parameter_function::get_alpha_micro ( const libMesh::Point &  qpoint)
inline

Definition at line 180 of file weight_parameter_function.h.

181  {
182  libMesh::PointLocatorBase& locator = *m_locator_unique_ptr.get();
183  const libMesh::Elem* elem = locator(qpoint);
184  double output = 0;
185 
186  if(elem->subdomain_id() == m_subdomain_idx_BIG)
187  {
188  output = 0;
189  }
190  else if(elem->subdomain_id() == m_subdomain_idx_micro)
191  {
192  output = 1;
193  }
194  else if(elem->subdomain_id() == m_subdomain_idx_both)
195  {
196  output = 1 - m_alpha_eps;
197  }
198  else if(elem->subdomain_id() == m_subdomain_idx_coupling)
199  {
200  output = m_alpha_coupling_micro;
201  }
202 
203  return output;
204  }
std::unique_ptr< libMesh::PointLocatorBase > m_locator_unique_ptr
void weight_parameter_function::set_parameters ( double  alpha_eps,
double  alpha_coupling_BIG,
int  subdomain_idx_BIG,
int  subdomain_idx_micro,
int  subdomain_idx_both,
int  subdomain_idx_coupling 
)
inline

Definition at line 67 of file weight_parameter_function.h.

69  {
70  m_alpha_eps = alpha_eps;
71 
72  m_alpha_coupling_BIG = alpha_coupling_BIG;
73  m_alpha_coupling_micro = 1. - alpha_coupling_BIG;
74 
75  m_subdomain_idx_BIG = subdomain_idx_BIG;
76  m_subdomain_idx_micro = subdomain_idx_micro;
77  m_subdomain_idx_both = subdomain_idx_both;
78  m_subdomain_idx_coupling = subdomain_idx_coupling;
79  };
void weight_parameter_function::set_parameters ( std::string &  filename)
inline

Definition at line 81 of file weight_parameter_function.h.

82  {
83  GetPot field_parser;
84  field_parser.parse_input_file(filename, "#", "\n", " \t\n");
85 
86  if (field_parser.search(1, "MacroDomainOnlyIdx")) {
87  m_subdomain_idx_BIG = field_parser.next(
89  } else {
90  homemade_error_msg("Missing the macro domain only index!");
91  }
92 
93  if (field_parser.search(1, "MicroDomainOnlyIdx")) {
94  m_subdomain_idx_micro = field_parser.next(
96  } else {
97  homemade_error_msg("Missing the micro domain only index!");
98  }
99 
100  if (field_parser.search(1, "CouplingDomainIdx")) {
101  m_subdomain_idx_coupling = field_parser.next(
103  } else {
104  homemade_error_msg("Missing the coupling domain index!");
105  }
106 
107  if (field_parser.search(1, "BothDomainsIdx")) {
108  m_subdomain_idx_both = field_parser.next(
110  } else {
112  std::cout << " >> Warning: Both system's domain index not defined!" << std::endl;
113  }
114 
115  if (field_parser.search(1, "AlphaCouplingMacro")) {
116  m_alpha_coupling_BIG = field_parser.next(
119  } else if (field_parser.search(1, "AlphaCouplingMicro")) {
120  m_alpha_coupling_micro = field_parser.next(
123  } else {
124  m_alpha_coupling_BIG = 0.5;
126  std::cout << " >> Warning: Coupling weights not defined, using 0.5 for both systems!" << std::endl;
127  }
128 
129  if (field_parser.search(1, "AlphaEps")) {
130  m_alpha_eps = field_parser.next(m_alpha_eps);
131  } else {
132  m_alpha_eps = 1e-2;
133  std::cout << " >> Warning: Alpha epsilon not defined, using 1e-2!" << std::endl;
134  }
135  }
#define homemade_error_msg(msg)
Definition: common_header.h:73

Member Data Documentation

double weight_parameter_function::m_alpha_coupling_BIG
protected

Definition at line 22 of file weight_parameter_function.h.

double weight_parameter_function::m_alpha_coupling_micro
protected

Definition at line 23 of file weight_parameter_function.h.

double weight_parameter_function::m_alpha_eps
protected

Definition at line 21 of file weight_parameter_function.h.

libMesh::Mesh& weight_parameter_function::m_alpha_mesh
protected

Definition at line 18 of file weight_parameter_function.h.

std::unique_ptr<libMesh::PointLocatorBase> weight_parameter_function::m_locator_unique_ptr
protected

Definition at line 19 of file weight_parameter_function.h.

int weight_parameter_function::m_subdomain_idx_BIG
protected

Definition at line 25 of file weight_parameter_function.h.

int weight_parameter_function::m_subdomain_idx_both
protected

Definition at line 27 of file weight_parameter_function.h.

int weight_parameter_function::m_subdomain_idx_coupling
protected

Definition at line 28 of file weight_parameter_function.h.

int weight_parameter_function::m_subdomain_idx_micro
protected

Definition at line 26 of file weight_parameter_function.h.


The documentation for this class was generated from the following file: