Skip to content

Commit 2617649

Browse files
committed
Allow managing assembly-wide (as opposed to system-wide only) state vectors
1 parent eb53fc1 commit 2617649

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/chrono/physics/ChAssembly.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,8 @@ void ChAssembly::IntStateGather(const unsigned int off_x,
691691
const unsigned int off_v,
692692
ChStateDelta& v,
693693
double& T) {
694-
unsigned int displ_x = off_x - this->offset_x;
695-
unsigned int displ_v = off_v - this->offset_w;
694+
int displ_x = off_x - this->offset_x;
695+
int displ_v = off_v - this->offset_w;
696696

697697
for (auto& body : bodylist) {
698698
if (body->IsActive())
@@ -730,8 +730,8 @@ void ChAssembly::IntStateScatter(const unsigned int off_x,
730730
// - in particular, bodies and meshes must be processed *before* links, so that links can use
731731
// up-to-date body and node information
732732

733-
unsigned int displ_x = off_x - this->offset_x;
734-
unsigned int displ_v = off_v - this->offset_w;
733+
int displ_x = off_x - this->offset_x;
734+
int displ_v = off_v - this->offset_w;
735735

736736
for (auto& body : bodylist) {
737737
if (body->IsActive())
@@ -770,7 +770,7 @@ void ChAssembly::IntStateScatter(const unsigned int off_x,
770770
}
771771

772772
void ChAssembly::IntStateGatherAcceleration(const unsigned int off_a, ChStateDelta& a) {
773-
unsigned int displ_a = off_a - this->offset_w;
773+
int displ_a = off_a - this->offset_w;
774774

775775
for (auto& body : bodylist) {
776776
if (body->IsActive())
@@ -795,7 +795,7 @@ void ChAssembly::IntStateGatherAcceleration(const unsigned int off_a, ChStateDel
795795

796796
// From state derivative (acceleration) to system, sometimes might be needed
797797
void ChAssembly::IntStateScatterAcceleration(const unsigned int off_a, const ChStateDelta& a) {
798-
unsigned int displ_a = off_a - this->offset_w;
798+
int displ_a = off_a - this->offset_w;
799799

800800
for (auto& body : bodylist) {
801801
if (body->IsActive())
@@ -820,7 +820,7 @@ void ChAssembly::IntStateScatterAcceleration(const unsigned int off_a, const ChS
820820

821821
// From system to reaction forces (last computed) - some timestepper might need this
822822
void ChAssembly::IntStateGatherReactions(const unsigned int off_L, ChVectorDynamic<>& L) {
823-
unsigned int displ_L = off_L - this->offset_L;
823+
int displ_L = off_L - this->offset_L;
824824

825825
for (auto& body : bodylist) {
826826
if (body->IsActive())
@@ -845,7 +845,7 @@ void ChAssembly::IntStateGatherReactions(const unsigned int off_L, ChVectorDynam
845845

846846
// From reaction forces to system, ex. store last computed reactions in ChLinkBase objects for plotting etc.
847847
void ChAssembly::IntStateScatterReactions(const unsigned int off_L, const ChVectorDynamic<>& L) {
848-
unsigned int displ_L = off_L - this->offset_L;
848+
int displ_L = off_L - this->offset_L;
849849

850850
for (auto& body : bodylist) {
851851
if (body->IsActive())
@@ -874,8 +874,8 @@ void ChAssembly::IntStateIncrement(const unsigned int off_x,
874874
const ChState& x,
875875
const unsigned int off_v,
876876
const ChStateDelta& Dv) {
877-
unsigned int displ_x = off_x - this->offset_x;
878-
unsigned int displ_v = off_v - this->offset_w;
877+
int displ_x = off_x - this->offset_x;
878+
int displ_v = off_v - this->offset_w;
879879

880880
for (auto& body : bodylist) {
881881
if (body->IsActive())
@@ -907,8 +907,8 @@ void ChAssembly::IntStateGetIncrement(const unsigned int off_x,
907907
const ChState& x,
908908
const unsigned int off_v,
909909
ChStateDelta& Dv) {
910-
unsigned int displ_x = off_x - this->offset_x;
911-
unsigned int displ_v = off_v - this->offset_w;
910+
int displ_x = off_x - this->offset_x;
911+
int displ_v = off_v - this->offset_w;
912912

913913
for (auto& body : bodylist) {
914914
if (body->IsActive())
@@ -939,7 +939,7 @@ void ChAssembly::IntLoadResidual_F(const unsigned int off, ///< offset in R res
939939
ChVectorDynamic<>& R, ///< result: the R residual, R += c*F
940940
const double c) ///< a scaling factor
941941
{
942-
unsigned int displ_v = off - this->offset_w;
942+
int displ_v = off - this->offset_w;
943943

944944
for (auto& body : bodylist) {
945945
if (body->IsActive())
@@ -967,7 +967,7 @@ void ChAssembly::IntLoadResidual_Mv(const unsigned int off, ///< offset in
967967
const ChVectorDynamic<>& w, ///< the w vector
968968
const double c ///< a scaling factor
969969
) {
970-
unsigned int displ_v = off - this->offset_w;
970+
int displ_v = off - this->offset_w;
971971

972972
for (auto& body : bodylist) {
973973
if (body->IsActive())
@@ -991,7 +991,7 @@ void ChAssembly::IntLoadResidual_Mv(const unsigned int off, ///< offset in
991991
}
992992

993993
void ChAssembly::IntLoadLumpedMass_Md(const unsigned int off, ChVectorDynamic<>& Md, double& err, const double c) {
994-
unsigned int displ_v = off - this->offset_w;
994+
int displ_v = off - this->offset_w;
995995

996996
for (auto& body : bodylist) {
997997
if (body->IsActive())
@@ -1019,7 +1019,7 @@ void ChAssembly::IntLoadResidual_CqL(const unsigned int off_L, ///< offset in
10191019
const ChVectorDynamic<>& L, ///< the L vector
10201020
const double c ///< a scaling factor
10211021
) {
1022-
unsigned int displ_L = off_L - this->offset_L;
1022+
int displ_L = off_L - this->offset_L;
10231023

10241024
for (auto& body : bodylist) {
10251025
if (body->IsActive())
@@ -1048,7 +1048,7 @@ void ChAssembly::IntLoadConstraint_C(const unsigned int off_L, ///< offset in Q
10481048
bool do_clamp, ///< apply clamping to c*C?
10491049
double recovery_clamp ///< value for min/max clamping of c*C
10501050
) {
1051-
unsigned int displ_L = off_L - this->offset_L;
1051+
int displ_L = off_L - this->offset_L;
10521052

10531053
for (auto& body : bodylist) {
10541054
if (body->IsActive())
@@ -1075,7 +1075,7 @@ void ChAssembly::IntLoadConstraint_Ct(const unsigned int off_L, ///< offset in
10751075
ChVectorDynamic<>& Qc, ///< result: the Qc residual, Qc += c*Ct
10761076
const double c ///< a scaling factor
10771077
) {
1078-
unsigned int displ_L = off_L - this->offset_L;
1078+
int displ_L = off_L - this->offset_L;
10791079

10801080
for (auto& body : bodylist) {
10811081
if (body->IsActive())
@@ -1104,8 +1104,8 @@ void ChAssembly::IntToDescriptor(const unsigned int off_v,
11041104
const unsigned int off_L,
11051105
const ChVectorDynamic<>& L,
11061106
const ChVectorDynamic<>& Qc) {
1107-
unsigned int displ_L = off_L - this->offset_L;
1108-
unsigned int displ_v = off_v - this->offset_w;
1107+
int displ_L = off_L - this->offset_L;
1108+
int displ_v = off_v - this->offset_w;
11091109

11101110
for (auto& body : bodylist) {
11111111
if (body->IsActive())
@@ -1136,8 +1136,8 @@ void ChAssembly::IntFromDescriptor(const unsigned int off_v,
11361136
ChStateDelta& v,
11371137
const unsigned int off_L,
11381138
ChVectorDynamic<>& L) {
1139-
unsigned int displ_L = off_L - this->offset_L;
1140-
unsigned int displ_v = off_v - this->offset_w;
1139+
int displ_L = off_L - this->offset_L;
1140+
int displ_v = off_v - this->offset_w;
11411141

11421142
for (auto& body : bodylist) {
11431143
if (body->IsActive())

src/chrono/physics/ChSystem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ void ChSystem::IntToDescriptor(const unsigned int off_v,
731731
assembly.IntToDescriptor(off_v, v, R, off_L, L, Qc);
732732

733733
// Use also on contact container:
734-
unsigned int displ_L = off_L - assembly.offset_L;
735-
unsigned int displ_v = off_v - assembly.offset_w;
734+
int displ_L = off_L - assembly.offset_L;
735+
int displ_v = off_v - assembly.offset_w;
736736
contact_container->IntToDescriptor(displ_v + contact_container->GetOffset_w(), v, R,
737737
displ_L + contact_container->GetOffset_L(), L, Qc);
738738
}
@@ -745,8 +745,8 @@ void ChSystem::IntFromDescriptor(const unsigned int off_v,
745745
assembly.IntFromDescriptor(off_v, v, off_L, L);
746746

747747
// Use also on contact container:
748-
unsigned int displ_L = off_L - assembly.offset_L;
749-
unsigned int displ_v = off_v - assembly.offset_w;
748+
int displ_L = off_L - assembly.offset_L;
749+
int displ_v = off_v - assembly.offset_w;
750750
contact_container->IntFromDescriptor(displ_v + contact_container->GetOffset_w(), v,
751751
displ_L + contact_container->GetOffset_L(), L);
752752
}

0 commit comments

Comments
 (0)