Skip to content

Commit

Permalink
Merge pull request #3765 from alanw0/develop
Browse files Browse the repository at this point in the history
Bring recent STK development into Trilinos.
  • Loading branch information
prwolfe authored Oct 30, 2018
2 parents 39f77a8 + 2041c5d commit 6ee57d2
Show file tree
Hide file tree
Showing 138 changed files with 5,289 additions and 1,879 deletions.
51 changes: 38 additions & 13 deletions packages/stk/stk_balance/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ project votd
: build-dir $(stk_balance-builddir)
;

# This variable should contain the applications and associated files that
# must be installed for both developers and end users. Unless they need to
# be visible to end users, unittests should not be placed here.
local installed-end-user-files =
stk_balance
stk_balance_m2n
;
#
# This variable should contain the applications and associated files that will
# only be installed for and visible to developers.
# Note that if the --install-developer-files option is passed to bjam these will also
# be installed for end-users. (This is only intended to be used for testing.)
local installed-developer-files =
stk_balance_unit_tester
stk_balance_integration_tester
;

#
# SECTION 2: Development install
#
Expand All @@ -61,12 +78,12 @@ alias install-serial-targets
:
;

# Dependencies listed in this target are installed in the developer's project.
# This should include all executables and any other files needed for developer use.
explicit install-targets ;
alias install-targets
: stk_balance_unit_tester
stk_balance_integration_tester
stk_balance_m2n
stk_balance
: $(installed-end-user-files)
$(installed-developer-files)
;

#
Expand All @@ -91,19 +108,27 @@ install install-user-jamfile
explicit install-exe-targets ;
alias install-exe-targets : ;

# Note that all Sierra executable are installed in a common bin directory,
# not in a product-specific bin directory.
# Dependencies listed in this target are always installed for end users.
# This should include only those executables and any other files needed by end-users.
explicit install-user-bin ;
install install-user-bin
: stk_balance
stk_balance_m2n
: <location>$(install-bin-dir)
: $(installed-end-user-files)
[ if-defined-val $(install-developer-files-arg) :
# Targets listed here will only be installed if the --install-developer-files option
# is passed to bjam. This is intended for testing that requires things like
# unittests to be installed when they normally would not be.
$(installed-developer-files)
]
:
# Note that all Sierra executables are installed in a common bin directory,
# not in a product-specific bin directory.
<location>$(install-bin-dir)
;

explicit install-user-include ;
install install-user-include
: [ path.glob-tree $(stk_balance-root)/stk_balance : *.h *.hpp *.H ]
: <location>$(install-root)/stk/stk_balance/include <install-source-root>$(stk_balance-root)/stk_balance
: <location>$(install-root)/stk/stk_balance/include/stk_balance <install-source-root>$(stk_balance-root)/stk_balance
;

explicit install-user-lib ;
Expand All @@ -120,7 +145,7 @@ alias search_tolerance
: # No sources defined for header-only libraries.
: # No build requirements
: # No default build
: <include>$(stk_balance-root)/stk_balance/search_tolerance
: <include>$(stk_balance-root-inc)/stk_balance/search_tolerance
;

lib search_tolerance_algs
Expand All @@ -132,7 +157,7 @@ lib search_tolerance_algs
search_tolerance
/sierra/stk_mesh//stk_mesh_base
:
<include>$(stk_balance-root)/stk_balance/search_tolerance_algs/
<include>$(stk_balance-root-inc)/stk_balance/search_tolerance_algs/
[ ifuserbuild <file>$(stk_balance-root)/lib/libsearch_tolerance_algs.a ]
:
:
Expand All @@ -157,7 +182,7 @@ lib stk_balance_lib
/sierra/stk_tools//stk_tools_lib
/sierra/stk_util//stk_util_command_line
:
<include>$(stk_balance-root)/stk_balance
<include>$(stk_balance-root-inc)/stk_balance
[ ifuserbuild <file>$(stk_balance-root)/lib/libstk_balance_lib.a ]
:
:
Expand Down
15 changes: 2 additions & 13 deletions packages/stk/stk_balance/doc_tests/howToUseStkBalance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class ParmetisSettings : public stk::balance::GraphCreationSettings
return weightTable[element1Index][element2Index];
}

using BalanceSettings::getGraphVertexWeight;

virtual int getGraphVertexWeight(stk::topology type) const
{
switch(type)
Expand All @@ -139,46 +141,33 @@ class ParmetisSettings : public stk::balance::GraphCreationSettings
case stk::topology::LINE_2:
case stk::topology::BEAM_2:
return 1;
break;
case stk::topology::SHELL_TRIANGLE_3:
return 3;
break;
case stk::topology::SHELL_TRIANGLE_6:
return 6;
break;
case stk::topology::SHELL_QUADRILATERAL_4:
return 6;
break;
case stk::topology::SHELL_QUADRILATERAL_8:
return 12;
break;
case stk::topology::HEXAHEDRON_8:
return 3;
break;
case stk::topology::HEXAHEDRON_20:
return 12;
break;
case stk::topology::TETRAHEDRON_4:
return 1;
break;
case stk::topology::TETRAHEDRON_10:
return 3;
break;
case stk::topology::WEDGE_6:
return 2;
break;
case stk::topology::WEDGE_15:
return 12;
break;
default:
if ( type.is_superelement( ))
{
return 10;
}
throw("Invalid Element Type In WeightsOfElement");
break;
}
return 0;
}
};
//ENDParmetisSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,50 +391,36 @@ int contactWeightForElementTopology(stk::topology type)
{
case stk::topology::PARTICLE:
return 20;
break;
case stk::topology::LINE_2:
case stk::topology::BEAM_2:
return 32;
break;
case stk::topology::SHELL_TRIANGLE_3:
return 14;
break;
case stk::topology::SHELL_TRIANGLE_6:
return 56;
break;
case stk::topology::SHELL_QUADRILATERAL_4:
return 24;
break;
case stk::topology::SHELL_QUADRILATERAL_8:
return 96;
break;
case stk::topology::HEXAHEDRON_8:
return 4;
break;
case stk::topology::HEXAHEDRON_20:
return 8;
break;
case stk::topology::TETRAHEDRON_4:
return 1;
break;
case stk::topology::TETRAHEDRON_10:
return 4; //
break;
case stk::topology::WEDGE_6:
return 4;
break;
case stk::topology::WEDGE_15:
return 8;
break;
default:
if ( type.is_superelement( ))
{
return 10;
}
throw("Invalid Element Type In WeightsOfElement");
break;
}
return 0;
}

TEST(Stkbalance, changeOptions)
Expand Down
13 changes: 0 additions & 13 deletions packages/stk/stk_balance/stk_balance/balanceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,46 +238,33 @@ int GraphCreationSettings::getGraphVertexWeight(stk::topology type) const
case stk::topology::BEAM_2:
case stk::topology::BEAM_3:
return 1;
break;
case stk::topology::SHELL_TRIANGLE_3:
return 3;
break;
case stk::topology::SHELL_TRIANGLE_6:
return 6;
break;
case stk::topology::SHELL_QUADRILATERAL_4:
return 6;
break;
case stk::topology::SHELL_QUADRILATERAL_8:
return 12;
break;
case stk::topology::HEXAHEDRON_8:
return 3;
break;
case stk::topology::HEXAHEDRON_20:
return 12;
break;
case stk::topology::TETRAHEDRON_4:
return 1;
break;
case stk::topology::TETRAHEDRON_10:
return 3;
break;
case stk::topology::WEDGE_6:
return 2;
break;
case stk::topology::WEDGE_15:
return 12;
break;
default:
if ( type.is_superelement( ))
{
return 10;
}
throw("Invalid Element Type In WeightsOfElement");
break;
}
return 0;
}

BalanceSettings::GraphOption GraphCreationSettings::getGraphOption() const
Expand Down
1 change: 1 addition & 0 deletions packages/stk/stk_balance/stk_balance/balanceUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class UserSpecifiedVertexWeightsSetting : public GraphCreationSettings
void setVertexWeights(const std::vector<double>& weights) { vertex_weights = weights; }
virtual std::vector<double> getVertexWeightsViaVector() const { return vertex_weights; }
virtual int getGraphVertexWeight(stk::topology type) const { return 1; }
virtual double getGraphVertexWeight(stk::mesh::Entity entity, int criteria_index) const { return 1.0; }
//virtual double getImbalanceTolerance() const { return 1.05; }
virtual void setDecompMethod(const std::string& input_method) { method = input_method;}
virtual std::string getDecompMethod() const { return method; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class IncrementalRebalance : public stk::unit_test_util::MeshFixture
check_migration();

size_t num_elements_migrated_to_me = calculate_migrated_elements();
EXPECT_TRUE(0 <= num_elements_migrated_to_me);
EXPECT_TRUE(0 < num_elements_migrated_to_me);
}

size_t count_global_non_particle_elements()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,6 @@ class StkParentRebalance : public StkFieldWeightRebalance
return elements;
}

void set_child_element_destination(stk::balance::DecompositionChangeList & decomp, stk::mesh::Entity childElement, const int destination) const
{
EXPECT_TRUE(decomp.get_bulk().is_valid(childElement));
decomp.set_entity_destination(childElement, destination);
}

void set_child_element_destination_from_parent_element(stk::balance::DecompositionChangeList & decomp, stk::mesh::Entity parentElement, const int destination) const
{
stk::mesh::EntityVector childElements = m_parentChildManager.get_child_elements(parentElement);
for (const auto & childElement : childElements) {
set_child_element_destination(decomp, childElement, destination);
}
}

void move_related_entities_with_parent_element(stk::balance::DecompositionChangeList & decomp) const
{
stk::mesh::EntityProcVec changedEntities = decomp.get_all_partition_changes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ TEST_F(TestBalanceBalanceSmallToLarge, MxN_decompositionWithoutAura)

class Mesh1x1x4 : public MeshFixtureMxNRebalance
{
protected:

void verify_node_sharing_info(const stk::mesh::EntityIdVector &goldSharedNodes, const stk::mesh::EntityVector &sharedNodes)
{
ASSERT_EQ(goldSharedNodes.size(), sharedNodes.size());
for(size_t nodeIndex = 0; nodeIndex < sharedNodes.size(); nodeIndex++)
{
stk::mesh::EntityId nodeId = get_bulk().identifier(sharedNodes[nodeIndex]);
EXPECT_EQ(goldSharedNodes[nodeIndex], nodeId);
}
}

protected:
virtual unsigned get_num_procs_initial_decomp() const { return 2; }
virtual unsigned get_num_procs_target_decomp() const { return 4; }
Expand Down
4 changes: 2 additions & 2 deletions packages/stk/stk_doc_tests/stk_mesh/createFacesEdgesHex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ namespace
EXPECT_EQ(goldValuesHexEdgeNodesFromCreateEdges[i][0], bulkData.identifier(edgeNodes[0]));
EXPECT_EQ(goldValuesHexEdgeNodesFromCreateEdges[i][1], bulkData.identifier(edgeNodes[1]));

hex.edge_nodes(globalIdsHex, i, edgeNodeIds);
hex.edge_nodes((stk::mesh::EntityId*)globalIdsHex, i, (unsigned*)edgeNodeIds);
EXPECT_EQ(goldValuesHexEdgeNodesFromStkTopology[i][0], edgeNodeIds[0]);
EXPECT_EQ(goldValuesHexEdgeNodesFromStkTopology[i][1], edgeNodeIds[1]);
}
Expand All @@ -269,7 +269,7 @@ namespace
EXPECT_EQ(goldValuesForHexFaceNodesFromCreateFaces[i][2], bulkData.identifier(faceNodes[2])) << "failed for face " << i << std::endl;
EXPECT_EQ(goldValuesForHexFaceNodesFromCreateFaces[i][3], bulkData.identifier(faceNodes[3])) << "failed for face " << i << std::endl;

hex.face_nodes(globalIdsHex, i, faceNodeIds);
hex.face_nodes((stk::mesh::EntityId*)globalIdsHex, i, (unsigned*)faceNodeIds);
EXPECT_EQ(goldValuesForHexFaceNodesFromStkTopology[i][0], faceNodeIds[0]);
EXPECT_EQ(goldValuesForHexFaceNodesFromStkTopology[i][1], faceNodeIds[1]);
EXPECT_EQ(goldValuesForHexFaceNodesFromStkTopology[i][2], faceNodeIds[2]);
Expand Down
6 changes: 3 additions & 3 deletions packages/stk/stk_doc_tests/stk_topology/equivalent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ TEST(stk_topology_understanding, equivalent_elements)

stk::topology hex8 = stk::topology::HEX_8;

areElementsEquivalent = hex8.equivalent(hex1, hex2);
areElementsEquivalent = hex8.equivalent((unsigned*)hex1, (unsigned*)hex2);
EXPECT_TRUE(areElementsEquivalent.first);
areElementsEquivalent = hex8.equivalent(hex1, hex3);
areElementsEquivalent = hex8.equivalent((unsigned*)hex1, (unsigned*)hex3);
EXPECT_FALSE(areElementsEquivalent.first);
}
}
Expand All @@ -63,7 +63,7 @@ TEST(stk_topology_understanding, equivalent_elements)

stk::topology triangular_shell = stk::topology::SHELL_TRIANGLE_3;

areElementsEquivalent = triangular_shell.equivalent(triangle_1, triangle_2);
areElementsEquivalent = triangular_shell.equivalent((unsigned*)triangle_1, (unsigned*)triangle_2);

EXPECT_TRUE(areElementsEquivalent.first);

Expand Down
Loading

0 comments on commit 6ee57d2

Please sign in to comment.