Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/fem/src/discretization/4C_fem_discretization_hdg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void Core::FE::DbcHDG::read_dirichlet_condition(const Teuchos::ParameterList& pa
const int lid = discret.dof_row_map(0)->lid(gid);

// set toggle vector
info.toggle[lid] = 1;
info.toggle.get_local_values()[lid] = 1;
// amend vector of DOF-IDs which are Dirichlet BCs
if (dbcgids[set_row] != nullptr) (*dbcgids[set_row]).insert(gid);
pressureDone = true;
Expand Down Expand Up @@ -383,15 +383,15 @@ void Core::FE::DbcHDG::read_dirichlet_condition(const Teuchos::ParameterList& pa
if (onoff[onesetj] == 0)
{
// no DBC on this dof, set toggle zero
info.toggle[lid] = 0;
info.toggle.get_local_values()[lid] = 0;
// get rid of entry in DBC map - if it exists
if (dbcgids[set_row] != nullptr) (*dbcgids[set_row]).erase(gid);
continue;
}
else // if (onoff[onesetj]==1)
{
// dof has DBC, set toggle vector one
info.toggle[lid] = 1;
info.toggle.get_local_values()[lid] = 1;
// amend vector of DOF-IDs which are dirichlet BCs
if (dbcgids[set_row] != nullptr) (*dbcgids[set_row]).insert(gid);
}
Expand Down Expand Up @@ -579,7 +579,7 @@ void Core::FE::DbcHDG::do_dirichlet_condition(const Teuchos::ParameterList& para
int onesetj = j / dofpercomponent;

// check whether dof gid is a dbc gid
if (toggle[lid] == 0) continue;
if (toggle.get_local_values()[lid] == 0) continue;

std::vector<double> value(deg + 1, val[onesetj]);

Expand Down
21 changes: 11 additions & 10 deletions src/core/fem/src/discretization/4C_fem_discretization_utils_dbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void Core::FE::Dbc::read_dirichlet_condition(const Teuchos::ParameterList& param
int onesetj = j % numdf;

// get the current hierarchical order this dof is currently applying to
const int current_order = info.hierarchy[lid];
const int current_order = info.hierarchy.get_local_values()[lid];

if (onoff[onesetj] == 0)
{
Expand All @@ -318,7 +318,7 @@ void Core::FE::Dbc::read_dirichlet_condition(const Teuchos::ParameterList& param
if (hierarchical_order < current_order)
{
// no DBC on this dof, set toggle zero
info.toggle[lid] = 0;
info.toggle.get_local_values()[lid] = 0;

// get rid of entry in row DBC map - if it exists
if (isrow and (dbcgids[set_row])) (*dbcgids[set_row]).erase(gid);
Expand All @@ -327,7 +327,7 @@ void Core::FE::Dbc::read_dirichlet_condition(const Teuchos::ParameterList& param
if (dbcgids[set_col]) (*dbcgids[set_col]).erase(gid);

// record the current hierarchical order of the DBC dof
info.hierarchy[lid] = hierarchical_order;
info.hierarchy.get_local_values()[lid] = hierarchical_order;
}
}
else // if (onoff[onesetj]==1)
Expand All @@ -347,13 +347,13 @@ void Core::FE::Dbc::read_dirichlet_condition(const Teuchos::ParameterList& param

// check: if the dof has been fixed before and the DBC set it to a different value, then an
// inconsistency is detected.
if ((hierarchical_order == current_order) && (info.toggle[lid] == 1))
if ((hierarchical_order == current_order) && (info.toggle.get_local_values()[lid] == 1))
{
// get the current prescribed value of dof
const double current_val = info.values[lid];

// get the current condition that prescribed value of dof
const int current_cond = info.condition[lid];
const int current_cond = info.condition.get_local_values()[lid];

// if the current condition set the dof value to other value, then we found an
// inconsistency. The basis for this is: Overwriting should be allowed over hierarchies
Expand Down Expand Up @@ -391,7 +391,7 @@ void Core::FE::Dbc::read_dirichlet_condition(const Teuchos::ParameterList& param
"This couldn't happen, except if you try to read DBC not in descending order.");

// dof has DBC, set toggle vector one
info.toggle[lid] = 1;
info.toggle.get_local_values()[lid] = 1;

// amend set of row DOF-IDs which are dirichlet BCs
if (isrow and (dbcgids[set_row])) (*dbcgids[set_row]).insert(gid);
Expand All @@ -403,13 +403,14 @@ void Core::FE::Dbc::read_dirichlet_condition(const Teuchos::ParameterList& param
}

// record the lowest hierarchical order of the DBC dof
if (hierarchical_order < current_order) info.hierarchy[lid] = hierarchical_order;
if (hierarchical_order < current_order)
info.hierarchy.get_local_values()[lid] = hierarchical_order;

// record the prescribed value of dof if it is fixed
info.values.get_values()[lid] = value;

// record the condition that assign the value
info.condition[lid] = cond.id();
info.condition.get_local_values()[lid] = cond.id();
}
} // loop over nodal DOFs
} // loop over nodes
Expand Down Expand Up @@ -524,8 +525,8 @@ void Core::FE::Dbc::do_dirichlet_condition(const Teuchos::ParameterList& params,
// check whether dof gid is a dbc gid and is prescribed only by the current condition
const bool dbc_on_dof_is_off = (onoff[onesetj] == 0); // dof is not DBC by current condition
const bool dbc_toggle_is_off =
(toggle[lid] == 0); // dof is not prescribed by current condition or
// is unprescribed by lower hierarchy condition
(toggle.get_local_values()[lid] == 0); // dof is not prescribed by current condition or
// is unprescribed by lower hierarchy condition
if (dbc_on_dof_is_off || dbc_toggle_is_off) continue;

std::vector<double> value(deg + 1, val[onesetj]);
Expand Down
44 changes: 23 additions & 21 deletions src/core/fem/src/dofset/4C_fem_dofset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void Core::DOFSets::DofSet::print(std::ostream& os) const
os << "-------------------------- Proc " << proc << " :\n";
for (int i = 0; i < numdfcolelements_->local_length(); ++i)
{
int numdf = (*numdfcolelements_)[i];
int idx = (*idxcolelements_)[i];
int numdf = (numdfcolelements_->get_local_values())[i];
int idx = (idxcolelements_->get_local_values())[i];
os << i << ": ";
for (int j = 0; j < numdf; ++j) os << (idx + j) << " ";
os << "\n";
Expand All @@ -70,8 +70,8 @@ void Core::DOFSets::DofSet::print(std::ostream& os) const
os << "-------------------------- Proc " << proc << " :\n";
for (int i = 0; i < numdfcolnodes_->local_length(); ++i)
{
int numdf = (*numdfcolnodes_)[i];
int idx = (*idxcolnodes_)[i];
int numdf = (numdfcolnodes_->get_local_values())[i];
int idx = (idxcolnodes_->get_local_values())[i];

os << i << ": ";
for (int j = 0; j < numdf; ++j) os << (idx + j) << " ";
Expand All @@ -89,8 +89,8 @@ void Core::DOFSets::DofSet::print(std::ostream& os) const
os << "-------------------------- Proc " << proc << " :\n";
for (int i = 0; i < numdfcolfaces_->local_length(); ++i)
{
int numdf = (*numdfcolfaces_)[i];
int idx = (*idxcolfaces_)[i];
int numdf = (numdfcolfaces_->get_local_values())[i];
int idx = (idxcolfaces_->get_local_values())[i];
os << i << ": ";
for (int j = 0; j < numdf; ++j) os << (idx + j) << " ";
os << "\n";
Expand Down Expand Up @@ -221,7 +221,7 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
for (int i = 0; i < numrownodes; ++i)
{
Core::Nodes::Node* actnode = dis.l_row_node(i);
num_dof_rownodes[i] = num_dof_per_node(*actnode);
num_dof_rownodes.get_local_values()[i] = num_dof_per_node(*actnode);
}

int minnodegid = get_minimal_node_gid_if_relevant(dis);
Expand Down Expand Up @@ -303,18 +303,18 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
{
if (condition_id == -1) continue;
// check total number of dofs and determine which dofs are to be coupled
if (numdofcond[condition_id] != num_dof_rownodes[i])
if (numdofcond[condition_id] != num_dof_rownodes.get_local_values()[i])
FOUR_C_THROW("ERROR: Number of DoFs in coupling condition {} does not match node {}",
numdofcond[condition_id], num_dof_rownodes[i]);
numdofcond[condition_id], num_dof_rownodes.get_local_values()[i]);
if (masterIds[condition_id] != gid) is_slave = true;
}

if (is_slave)
{ // in case it is a slave node (in some dof): the dof is cancelled, replaced by the master
// dof
int numdf = num_dof_rownodes[i];
int numdf = num_dof_rownodes.get_local_values()[i];
int dof = count + (gid - minnodegid) * maxnodenumdf;
idxrownodes[i] = dof;
idxrownodes.get_local_values()[i] = dof;
std::vector<int>& dofs = nodedofset[gid];
dofs.reserve(numdf);
for (int j = 0; j < numdf; ++j)
Expand All @@ -338,9 +338,9 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
// standard treatment for non-coupling nodes and master coupling nodes
{
// now treat only the nodes, which are master and thus did not get the special treatment
int numdf = num_dof_rownodes[i];
int numdf = num_dof_rownodes.get_local_values()[i];
int dof = count + (gid - minnodegid) * maxnodenumdf;
idxrownodes[i] = dof;
idxrownodes.get_local_values()[i] = dof;
std::vector<int>& dofs = nodedofset[gid];
dofs.reserve(numdf);
for (int j = 0; j < numdf; ++j)
Expand Down Expand Up @@ -392,7 +392,8 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
if (faces[face]->owner() == mypid)
{
const int mylid = facedis->face_row_map()->lid(faces[face]->id());
numdfrowfaces[mylid] = num_dof_per_face(*(dis.l_col_element(i)), face);
numdfrowfaces.get_local_values()[mylid] =
num_dof_per_face(*(dis.l_col_element(i)), face);
}
}

Expand All @@ -408,9 +409,9 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
{
const int gid = faces[face]->id();
const int mylid = facedis->face_row_map()->lid(gid);
int numdf = numdfrowfaces[mylid];
int numdf = numdfrowfaces.get_local_values()[mylid];
int dof = count + (gid - minfacegid) * maxfacenumdf;
idxrowfaces[mylid] = dof;
idxrowfaces.get_local_values()[mylid] = dof;
std::vector<int>& dofs = facedofset[gid];
// do not visit the same face more than once
if (dofs.empty())
Expand Down Expand Up @@ -444,7 +445,7 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
Core::Elements::Element* actele = dis.l_row_element(i);
// const int gid = actele->Id();
int numdf = num_dof_per_element(*actele);
numdfrowelements[i] = numdf;
numdfrowelements.get_local_values()[i] = numdf;
}

int minelementgid = dis.element_row_map()->min_all_gid();
Expand All @@ -455,9 +456,9 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
{
Core::Elements::Element* actelement = dis.l_row_element(i);
const int gid = actelement->id();
int numdf = numdfrowelements[i];
int numdf = numdfrowelements.get_local_values()[i];
int dof = count + (gid - minelementgid) * maxelementnumdf;
idxrowelements[i] = dof;
idxrowelements.get_local_values()[i] = dof;
std::vector<int>& dofs = elementdofset[gid];
dofs.reserve(numdf);
for (int j = 0; j < numdf; ++j)
Expand Down Expand Up @@ -549,12 +550,13 @@ int Core::DOFSets::DofSet::assign_degrees_of_freedom(
{
if (i == 0)
{
(*shiftcolnodes_)[i] = 0;
(*shiftcolnodes_).get_local_values()[i] = 0;
}
else
{
Core::Nodes::Node* lastnode = dis.l_col_node(i - 1);
(*shiftcolnodes_)[i] = (*shiftcolnodes_)[i - 1] + num_dof_per_node(*lastnode);
(*shiftcolnodes_).get_local_values()[i] =
(shiftcolnodes_->get_local_values())[i - 1] + num_dof_per_node(*lastnode);
}
}
// **********************************************************************
Expand Down
50 changes: 27 additions & 23 deletions src/core/fem/src/dofset/4C_fem_dofset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace Core::DOFSets
{
int lid = node->lid();
if (lid == -1) return 0;
return (*numdfcolnodes_)[lid];
return (numdfcolnodes_->get_local_values())[lid];
}

/// Get number of dofs for given element
Expand All @@ -122,9 +122,9 @@ namespace Core::DOFSets
int lid = element->lid();
if (lid == -1) return 0;
if (element->is_face_element())
return (numdfcolfaces_ != nullptr) ? (*numdfcolfaces_)[lid] : 0;
return (numdfcolfaces_ != nullptr) ? (numdfcolfaces_->get_local_values())[lid] : 0;
else
return (*numdfcolelements_)[lid];
return (numdfcolelements_->get_local_values())[lid];
}

/// Get the gid of a dof for given node
Expand All @@ -133,9 +133,9 @@ namespace Core::DOFSets
int lid = node->lid();
if (lid == -1) return -1;
if (pccdofhandling_)
return dofscolnodes_->gid((*shiftcolnodes_)[lid] + dof);
return dofscolnodes_->gid((shiftcolnodes_->get_local_values())[lid] + dof);
else
return (*idxcolnodes_)[lid] + dof;
return (idxcolnodes_->get_local_values())[lid] + dof;
}

/// Get the gid of a dof for given element
Expand All @@ -144,22 +144,22 @@ namespace Core::DOFSets
int lid = element->lid();
if (lid == -1) return -1;
if (element->is_face_element())
return (idxcolfaces_ != nullptr) ? (*idxcolfaces_)[lid] + dof : -1;
return (idxcolfaces_ != nullptr) ? (idxcolfaces_->get_local_values())[lid] + dof : -1;
else
return (*idxcolelements_)[lid] + dof;
return (idxcolelements_->get_local_values())[lid] + dof;
}

/// Get the gid of all dofs of a node
std::vector<int> dof(const Core::Nodes::Node* node) const override
{
const int lid = node->lid();
if (lid == -1) return std::vector<int>();
const int idx = (*idxcolnodes_)[lid];
std::vector<int> dof((*numdfcolnodes_)[lid]);
const int idx = (idxcolnodes_->get_local_values())[lid];
std::vector<int> dof((numdfcolnodes_->get_local_values())[lid]);
for (unsigned i = 0; i < dof.size(); ++i)
{
if (pccdofhandling_)
dof[i] = dofscolnodes_->gid((*shiftcolnodes_)[lid] + i);
dof[i] = dofscolnodes_->gid((shiftcolnodes_->get_local_values())[lid] + i);
else
dof[i] = idx + i;
}
Expand All @@ -184,9 +184,11 @@ namespace Core::DOFSets

if (element->is_face_element() && idxcolfaces_ == nullptr) return std::vector<int>();

int idx = element->is_face_element() ? (*idxcolfaces_)[lid] : (*idxcolelements_)[lid];
std::vector<int> dof(
element->is_face_element() ? (*numdfcolfaces_)[lid] : (*numdfcolelements_)[lid]);
int idx = element->is_face_element() ? (idxcolfaces_->get_local_values())[lid]
: (idxcolelements_->get_local_values())[lid];
std::vector<int> dof(element->is_face_element()
? (numdfcolfaces_->get_local_values())[lid]
: (numdfcolelements_->get_local_values())[lid]);
for (unsigned i = 0; i < dof.size(); ++i) dof[i] = idx + i;
return dof;
}
Expand All @@ -196,12 +198,12 @@ namespace Core::DOFSets
{
int lid = node->lid();
if (lid == -1) return;
int idx = (*idxcolnodes_)[lid];
int size = (*numdfcolnodes_)[lid];
int idx = (idxcolnodes_->get_local_values())[lid];
int size = (numdfcolnodes_->get_local_values())[lid];
for (int i = 0; i < size; ++i)
{
if (pccdofhandling_)
lm.push_back(dofscolnodes_->gid((*shiftcolnodes_)[lid] + i));
lm.push_back(dofscolnodes_->gid((shiftcolnodes_->get_local_values())[lid] + i));
else
lm.push_back(idx + i);
}
Expand All @@ -215,13 +217,13 @@ namespace Core::DOFSets
{
const int lid = node->lid();
if (lid == -1) return;
const int idx = (*idxcolnodes_)[lid];
const int size = (*numdfcolnodes_)[lid];
const int idx = (idxcolnodes_->get_local_values())[lid];
const int size = (numdfcolnodes_->get_local_values())[lid];
FOUR_C_ASSERT(lm.size() >= (startindex + size), "vector<int> lm too small");
for (int i = 0; i < size; ++i)
{
if (pccdofhandling_)
lm[startindex + i] = dofscolnodes_->gid((*shiftcolnodes_)[lid] + i);
lm[startindex + i] = dofscolnodes_->gid((shiftcolnodes_->get_local_values())[lid] + i);
else
lm[startindex + i] = idx + i;
}
Expand All @@ -235,8 +237,10 @@ namespace Core::DOFSets

if (element->is_face_element() && idxcolfaces_ == nullptr) return;

int idx = element->is_face_element() ? (*idxcolfaces_)[lid] : (*idxcolelements_)[lid];
int size = element->is_face_element() ? (*numdfcolfaces_)[lid] : (*numdfcolelements_)[lid];
int idx = element->is_face_element() ? (idxcolfaces_->get_local_values())[lid]
: (idxcolelements_->get_local_values())[lid];
int size = element->is_face_element() ? (numdfcolfaces_->get_local_values())[lid]
: (numdfcolelements_->get_local_values())[lid];
for (int i = 0; i < size; ++i) lm.push_back(idx + i);
}

Expand All @@ -249,14 +253,14 @@ namespace Core::DOFSets
{
const int lid = node->lid();
if (lid == -1) return;
const int idx = (*idxcolnodes_)[lid];
const int idx = (idxcolnodes_->get_local_values())[lid];
// this method is used to setup the vector of number of dofs, so we cannot ask
// numdfcolelements_ here as above. Instead we have to ask the node itself
const int size = num_dof_per_node(*element, *node);
for (int i = 0; i < size; ++i)
{
if (pccdofhandling_)
lm.push_back(dofscolnodes_->gid((*shiftcolnodes_)[lid] + i));
lm.push_back(dofscolnodes_->gid((shiftcolnodes_->get_local_values())[lid] + i));
else
lm.push_back(idx + i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const Core::Nodes::Node* Core::DOFSets::DofSetDefinedMappingWrapper::get_source_
targetLid <= targetlidtosourcegidmapping_->local_length(), "Target Lid out of range!");

// get the gid of the source node
int sourcegid = (*targetlidtosourcegidmapping_)[targetLid];
int sourcegid = (targetlidtosourcegidmapping_->get_local_values())[targetLid];

// the target is not mapped -> return null pointer
if (sourcegid == -1) return nullptr;
Expand Down
Loading
Loading