Skip to content
Draft
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
3 changes: 1 addition & 2 deletions src/ale/4C_ale_resulttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ void ALE::AleResultTest::test_node(
if (dis != aledis_->name()) return;

int node = container.get<int>("NODE");
node -= 1;

int havenode(aledis_->have_global_node(node));
int isnodeofanybody(0);
Core::Communication::sum_all(&havenode, &isnodeofanybody, 1, aledis_->get_comm());

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1, aledis_->name());
FOUR_C_THROW("Node {} does not belong to discretization {}", node, aledis_->name());
}
else
{
Expand Down
3 changes: 1 addition & 2 deletions src/art_net/4C_art_net_artery_resulttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ void Arteries::ArteryResultTest::test_node(
if (dis != dis_->name()) return;

int node = container.get<int>("NODE");
node -= 1;

int havenode(dis_->have_global_node(node));
int isnodeofanybody(0);
Core::Communication::sum_all(&havenode, &isnodeofanybody, 1, dis_->get_comm());

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1, dis_->name());
FOUR_C_THROW("Node {} does not belong to discretization {}", node, dis_->name());
}
else
{
Expand Down
3 changes: 1 addition & 2 deletions src/core/fem/src/general/element/4C_fem_general_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,10 @@ void Core::Elements::Element::set_node_ids(const int nnode, const int* nodes)

/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void Core::Elements::Element::set_node_ids_one_based_index(
void Core::Elements::Element::set_node_ids(
const std::string& distype, const Core::IO::InputParameterContainer& container)
{
nodeid_ = container.get<std::vector<int>>(distype);
for (int& i : nodeid_) i -= 1;
node_.resize(0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ might become invalid after a redistribution of the discretization.
* Set the list of node ids this element is connected to. Here, the index
* starts at 1, not 0. This is used for the legacy element input.
*/
void set_node_ids_one_based_index(
void set_node_ids(
const std::string& distype, const Core::IO::InputParameterContainer& container);

/*!
Expand Down
2 changes: 1 addition & 1 deletion src/core/io/src/4C_io_input_file_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void Core::IO::read_design(InputFile& input, const std::string& name,
(name == "DVOL" && dname == "DVOLUME"),
"Wrong design node name: {}. Expected {}.", dname, name);

topology[dobj - 1].insert(nodeid - 1);
topology[dobj - 1].insert(nodeid);
}
else // fancy specification of the design nodes by specifying min or max of the domain
{ // works best on rectangular domains ;)
Expand Down
16 changes: 8 additions & 8 deletions src/core/io/src/4C_io_meshreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ namespace
Core::IO::InputParameterContainer data;
linedef.fully_parse(element_parser, data);

ele->set_node_ids_one_based_index(distype, data);
ele->set_node_ids(distype, data);
ele->read_element(eletype, distype, data);

// add element to discretization
Expand Down Expand Up @@ -690,11 +690,11 @@ namespace

if (type == "NODE")
{
int nodeid = parser.read<int>() - 1;
const int nodeid = parser.read<int>();
parser.consume("COORD");
auto coords = parser.read<std::vector<double>>(3);

max_node_id = std::max(max_node_id, nodeid) + 1;
max_node_id = std::max(max_node_id, nodeid);
std::vector<std::shared_ptr<Core::FE::Discretization>> dis =
find_dis_node(element_readers, nodeid);

Expand All @@ -709,13 +709,13 @@ namespace
// this node is a Nurbs control point
else if (type == "CP")
{
int cpid = parser.read<int>() - 1;
const int cpid = parser.read<int>();
parser.consume("COORD");
auto coords = parser.read<std::vector<double>>(3);
double weight = parser.read<double>();

max_node_id = std::max(max_node_id, cpid) + 1;
if (cpid != line_count)
max_node_id = std::max(max_node_id, cpid);
if (cpid != line_count + 1)
FOUR_C_THROW(
"Reading of control points {} failed: They must be numbered consecutive!!", cpid);
std::vector<std::shared_ptr<Core::FE::Discretization>> diss =
Expand Down Expand Up @@ -745,10 +745,10 @@ namespace
std::vector<std::array<double, 3>> fibers;
std::map<Core::Nodes::AngleType, double> angles;

int nodeid = parser.read<int>() - 1;
const int nodeid = parser.read<int>();
parser.consume("COORD");
auto coords = parser.read<std::vector<double>>(3);
max_node_id = std::max(max_node_id, nodeid) + 1;
max_node_id = std::max(max_node_id, nodeid);

while (!parser.at_end())
{
Expand Down
3 changes: 1 addition & 2 deletions src/fluid/4C_fluid_result_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ void FLD::FluidResultTest::test_node(
if (dis != fluiddis_->name()) return;

int node = container.get<int>("NODE");
node -= 1;

int havenode(fluiddis_->have_global_node(node));
int isnodeofanybody(0);
Core::Communication::sum_all(&havenode, &isnodeofanybody, 1, fluiddis_->get_comm());

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1, fluiddis_->name());
FOUR_C_THROW("Node {} does not belong to discretization {}", node, fluiddis_->name());
}
else
{
Expand Down
15 changes: 3 additions & 12 deletions src/fluid_xfluid/4C_fluid_xfluid_resulttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ FOUR_C_NAMESPACE_OPEN


FLD::XFluidResultTest::XFluidResultTest(const FLD::XFluid& xfluid)
: Core::Utils::ResultTest("XFLUID"),
discret_(xfluid.discret_),
velnp_(xfluid.state_->velnp_),
node_from_zero_(true)
: Core::Utils::ResultTest("XFLUID"), discret_(xfluid.discret_), velnp_(xfluid.state_->velnp_)
{
}

Expand All @@ -31,11 +28,8 @@ FLD::XFluidResultTest::XFluidResultTest(const FLD::XFluidFluid& xfluid)
discret_(xfluid.discret_),
velnp_(xfluid.state_->velnp_),
coupl_discret_(xfluid.embedded_fluid_->discretization()),
coupl_velnp_(xfluid.embedded_fluid_->velnp()),
node_from_zero_(false)
coupl_velnp_(xfluid.embedded_fluid_->velnp())
{
// Todo: remove the "node_from_zero" flag for fluidfluid:
// adapt the test cases!
}

void FLD::XFluidResultTest::test_node(
Expand All @@ -46,9 +40,6 @@ void FLD::XFluidResultTest::test_node(

int node = container.get<int>("NODE");

// Todo: remove!
if (node_from_zero_) node -= 1;

if (dis == discret_->name())
{
test_node(container, nerr, test_count, node, *discret_, *velnp_);
Expand All @@ -71,7 +62,7 @@ void FLD::XFluidResultTest::test_node(const Core::IO::InputParameterContainer& c

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1, discret.name());
FOUR_C_THROW("Node {} does not belong to discretization {}", node, discret.name());
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions src/fluid_xfluid/4C_fluid_xfluid_resulttest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ namespace FLD

/// solution vector for additional coupling discretization
std::shared_ptr<const Core::LinAlg::Vector<double>> coupl_velnp_;

/// take care of node numbering off-by-one (will be removed soon)
const bool node_from_zero_;
};

} // namespace FLD
Expand Down
3 changes: 1 addition & 2 deletions src/fsi/src/utils/4C_fsi_resulttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,14 @@ void FSI::FSIResultTest::test_node(
const Core::IO::InputParameterContainer& container, int& nerr, int& test_count)
{
int node = container.get<int>("NODE");
node -= 1;

int havenode(slavedisc_->have_global_node(node));
int isnodeofanybody(0);
Core::Communication::sum_all(&havenode, &isnodeofanybody, 1, slavedisc_->get_comm());

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1, slavedisc_->name());
FOUR_C_THROW("Node {} does not belong to discretization {}", node, slavedisc_->name());
}
else
{
Expand Down
3 changes: 1 addition & 2 deletions src/lubrication/src/4C_lubrication_resulttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ void Lubrication::ResultTest::test_node(
if (dis != dis_->name()) return;

int node = container.get<int>("NODE");
node -= 1;

int havenode(dis_->have_global_node(node));
int isnodeofanybody(0);
Core::Communication::sum_all(&havenode, &isnodeofanybody, 1, dis_->get_comm());

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1, dis_->name());
FOUR_C_THROW("Node {} does not belong to discretization {}", node, dis_->name());
}
else
{
Expand Down
23 changes: 19 additions & 4 deletions src/mat/4C_mat_scatra_multiscale_gp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,26 @@ void Mat::ScatraMultiScaleGP::init()
"Must have identical one-step-theta time integration factor on macro and micro scales!");
if (microdis->num_global_elements() == 0)
FOUR_C_THROW("No elements in TRANSPORT ELEMENTS section of micro-scale input file!");
if (microdis->g_node(0)->x()[0] != 0.0)

// Extract all x-coordinates of the microscale discretization, sort them, and check that the
// first and last x-coordinates are 0 and > 0, respectively.
{
FOUR_C_THROW(
"Micro-scale domain must have one end at coordinate 0 and the other end at a coordinate "
"> 0!");
// The micro discretization is replicated on all ranks, so this will catch all x-coordinates.
std::vector<double> xcoords;
xcoords.reserve(microdis->num_my_row_nodes());
for (const auto& node : microdis->my_row_node_range())
{
xcoords.push_back(node->x()[0]);
}
std::ranges::sort(xcoords);

FOUR_C_ASSERT_ALWAYS(xcoords[0] == 0.0,
"First x-coordinate of micro-scale discretization must be 0! First x-coordinate is {}",
xcoords[0]);

FOUR_C_ASSERT_ALWAYS(xcoords.back() > 0.0,
"Last x-coordinate of micro-scale discretization must be > 0! Last x-coordinate is {}",
xcoords.back());
}

// extract multi-scale coupling conditions from micro-scale discretization
Expand Down
1 change: 0 additions & 1 deletion src/particle_wall/4C_particle_wall_result_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void PARTICLEWALL::WallResultTest::test_node(

// extract node id
int node = container.get<int>("NODE");
node -= 1;

int havenode(walldiscretization_->have_global_node(node));
int havenodeonanyproc(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void PoroPressureBased::ResultTest::test_node(
if (dis != porotimint_.discretization()->name()) return;

int node = container.get<int>("NODE");
node -= 1;

int havenode(porotimint_.discretization()->have_global_node(node));
int isnodeofanybody(0);
Expand All @@ -48,8 +47,8 @@ void PoroPressureBased::ResultTest::test_node(

if (isnodeofanybody == 0)
{
FOUR_C_THROW("Node {} does not belong to discretization {}", node + 1,
porotimint_.discretization()->name());
FOUR_C_THROW(
"Node {} does not belong to discretization {}", node, porotimint_.discretization()->name());
}
else
{
Expand Down
25 changes: 12 additions & 13 deletions src/post/4C_post_ensight_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int inode = 0; inode < numnp; ++inode)
{
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[inode]->id()) + 1);
write(geofile, proc0map->LID(nodes[inode]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[inode]->id());
}
Expand All @@ -456,7 +456,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int inode = 0; inode < numnp; ++inode)
{
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[Hex20_FourCToEnsightGold[inode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[Hex20_FourCToEnsightGold[inode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[Hex20_FourCToEnsightGold[inode]]->id());
}
Expand All @@ -468,7 +468,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::hex16); ++isubele)
for (int isubnode = 0; isubnode < 8; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[subhex16map[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[subhex16map[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[subhex16map[isubele][isubnode]]->id());
break;
Expand All @@ -479,7 +479,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::hex18); ++isubele)
for (int isubnode = 0; isubnode < 8; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[subhex18map[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[subhex18map[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[subhex18map[isubele][isubnode]]->id());
break;
Expand All @@ -490,7 +490,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::hex27); ++isubele)
for (int isubnode = 0; isubnode < 8; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[subhexmap[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[subhexmap[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[subhexmap[isubele][isubnode]]->id());
break;
Expand All @@ -501,7 +501,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::quad9); ++isubele)
for (int isubnode = 0; isubnode < 4; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[subquadmap[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[subquadmap[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[subquadmap[isubele][isubnode]]->id());
break;
Expand All @@ -512,7 +512,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::line3); ++isubele)
for (int isubnode = 0; isubnode < 2; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[sublinemap[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[sublinemap[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[sublinemap[isubele][isubnode]]->id());
break;
Expand All @@ -528,7 +528,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int inode = 0; inode < numnp; ++inode)
{
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[inode]->id()) + 1);
write(geofile, proc0map->LID(nodes[inode]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[inode]->id());
}
Expand All @@ -545,7 +545,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::quad9); ++isubele)
for (int isubnode = 0; isubnode < 4; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[subquadmap[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[subquadmap[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[subquadmap[isubele][isubnode]]->id());
}
Expand All @@ -561,7 +561,7 @@ void EnsightWriter::write_cells(std::ofstream& geofile,
for (int isubele = 0; isubele < get_num_sub_ele(Core::FE::CellType::hex27); ++isubele)
for (int isubnode = 0; isubnode < 8; ++isubnode)
if (myrank_ == 0) // proc0 can write its elements immediately
write(geofile, proc0map->LID(nodes[subhexmap[isubele][isubnode]]->id()) + 1);
write(geofile, proc0map->LID(nodes[subhexmap[isubele][isubnode]]->id()));
else // elements on other procs have to store their global node ids
nodevector.push_back(nodes[subhexmap[isubele][isubnode]]->id());
}
Expand Down Expand Up @@ -657,7 +657,7 @@ void EnsightWriter::write_node_connectivity_par(std::ofstream& geofile,
for (int i = 0; i < (int)nodeids.size(); ++i)
{
// using the same map as for the writing the node coordinates
int id = (proc0map.LID(nodeids[i])) + 1;
int id = (proc0map.LID(nodeids[i]));
write(geofile, id);
}
nodeids.clear();
Expand Down Expand Up @@ -2379,8 +2379,7 @@ void EnsightWriter::write_coordinates_for_polynomial_shapefunctions(std::ofstrea
// first write node global ids (default)
for (int inode = 0; inode < proc0map->NumGlobalElements(); ++inode)
{
write(geofile, proc0map->GID(inode) + 1);
// gid+1 delivers the node numbering of the input file starting with 1
write(geofile, proc0map->GID(inode));
}
}
// now write the coordinate information
Expand Down
1 change: 0 additions & 1 deletion src/red_airways/4C_red_airways_resulttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ void Airway::RedAirwayResultTest::test_node(
if (dis != dis_->name()) return;

int node = container.get<int>("NODE");
node -= 1;

int havenode(dis_->have_global_node(node));
int isnodeofanybody(0);
Expand Down
Loading
Loading