waves
Basic FE playground
DirichletList.hpp
Go to the documentation of this file.
1 namespace katoptron
2 {
3 
20 template <typename scalar>
21 DirichletList<scalar>::DirichletList(Problem &pbl, Teuchos::RCP<Map> map, Teuchos::RCP<ElementsList> elementsList)
22 {
25 
26  typedef EnsembleTraits<scalar> ET;
27  const int ensemble_size = ET::size;
28 
29  local_ordinal_type numDPN = map->numPrimalDPN;
30  dirichlet_number = pbl.duBCs.size();
31  local_ordinal_type maxNumNodesPerBC = 0;
32 
33  std::vector<std::vector<global_ordinal_type>> bcNodes = {};
34 
35  for (auto i = 0; i < dirichlet_number; ++i)
36  {
37  std::vector<global_ordinal_type> tmpMyBcNodes = {};
38  std::vector<global_ordinal_type> myBcNodes = {};
39 
40  for (auto j = 0; j < pbl.duBCs[i]->nodes.size(); ++j)
41  tmpMyBcNodes.push_back(pbl.duBCs[i]->nodes[j]->row);
42 
43  std::sort(tmpMyBcNodes.begin(), tmpMyBcNodes.end());
44 
45  if (tmpMyBcNodes.size() >= 1)
46  myBcNodes.push_back(tmpMyBcNodes[0]);
47 
48  for (auto ii = 1; ii < tmpMyBcNodes.size(); ++ii)
49  if (tmpMyBcNodes[ii] != tmpMyBcNodes[ii - 1])
50  myBcNodes.push_back(tmpMyBcNodes[ii]);
51 
52  bcNodes.push_back(myBcNodes);
53  if (maxNumNodesPerBC < myBcNodes.size())
54  maxNumNodesPerBC = myBcNodes.size();
55  }
56 
57  dirichlet_size = 0;
58  dirichlet_nodes = 1;
59  dirichlet_nodesList = Kokkos::View<int **, Kokkos::LayoutRight>("R", dirichlet_number, dirichlet_nodes + maxNumNodesPerBC);
60 
61  for (auto i = 0; i < dirichlet_number; ++i)
62  {
63  dirichlet_nodesList(i, dirichlet_size) = bcNodes[i].size();
64  for (auto j = 0; j < bcNodes[i].size(); ++j)
65  {
66  dirichlet_nodesList(i, dirichlet_nodes + j) = bcNodes[i][j];
67  }
68  }
69 
70  dirichlet_time = 0;
71  dirichlet_dofs = 1;
72  dirichlet_values = 1 + numDPN;
73  dirichlet_values_list = Kokkos::View<scalar ***, Kokkos::LayoutRight>("R", dirichlet_number, 1, 1 + 2 * numDPN);
74  for (auto i = 0; i < dirichlet_number; ++i)
75  {
76  dirichlet_values_list(i, 0, dirichlet_time) = 0.; //to change latter
77  for (auto j = 0; j < numDPN; ++j)
78  if (pbl.duBCs[i]->which_dof[j])
79  dirichlet_values_list(i, 0, dirichlet_dofs + j) = 1;
80  else
81  dirichlet_values_list(i, 0, dirichlet_dofs + j) = 0;
82 
83  for (int j = 0; j < ensemble_size; ++j)
84  {
85  ET::coeff(dirichlet_values_list(i, 0, dirichlet_values + 0), j) = pbl.duBCs[i]->x_values[j];
86  ET::coeff(dirichlet_values_list(i, 0, dirichlet_values + 1), j) = pbl.duBCs[i]->y_values[j];
87  ET::coeff(dirichlet_values_list(i, 0, dirichlet_values + 2), j) = pbl.duBCs[i]->z_values[j];
88  if (numDPN == 4)
89  ET::coeff(dirichlet_values_list(i, 0, dirichlet_values + 3), j) = pbl.duBCs[i]->T_values[j];
90  }
91  }
92 }
93 }; // namespace katoptron
katoptron::Map::local_ordinal_type
int local_ordinal_type
Definition: Map.h:27
katoptron::Map::global_ordinal_type
int global_ordinal_type
Definition: Map.h:28
local_ordinal_type
katoptron::Map::local_ordinal_type local_ordinal_type
Definition: ResultsETI.cpp:4
katoptron::DirichletList::local_ordinal_type
Map::local_ordinal_type local_ordinal_type
Definition: DirichletList.h:30
EnsembleTraits
Definition: EnsembleTraits.h:8
katoptron
katoptron namespace
Definition: Algebraic.h:18
katoptron::Problem
Class which is used to specify in Python the thermomechanical to solve.
Definition: wProblem.h:19
katoptron::Problem::duBCs
std::vector< Dirichlet * > duBCs
mechanical Dirichlet boundary conditions
Definition: wProblem.h:27
global_ordinal_type
katoptron::Map::global_ordinal_type global_ordinal_type
Definition: ResultsETI.cpp:5
katoptron::DirichletList::DirichletList
DirichletList(Problem &pbl, Teuchos::RCP< Map > map, Teuchos::RCP< ElementsList > elementsList)
DirichletList constructor.
Definition: DirichletList.hpp:21