Skip to content

Commit

Permalink
Passes libtest for source
Browse files Browse the repository at this point in the history
  • Loading branch information
rwalkerlewis committed Oct 27, 2023
1 parent 650cfac commit 440fd67
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion libsrc/pylith/sources/AuxiliaryFactoryMomentTensorForce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pylith::sources::AuxiliaryFactoryMomentTensorForce::addMomentTensor(void) { // m
pylith::topology::Field::Description description;
description.label = subfieldName;
description.alias = subfieldName;
description.vectorFieldType = pylith::topology::Field::OTHER;
description.vectorFieldType = (3 == _spaceDim) ? pylith::topology::Field::TENSOR : pylith::topology::Field::OTHER;
description.numComponents = tensorSize;
description.componentNames.resize(tensorSize);
for (int i = 0; i < tensorSize; ++i) {
Expand Down
3 changes: 2 additions & 1 deletion libsrc/pylith/sources/AuxiliaryFactorySourceTime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pylith::sources::AuxiliaryFactorySourceTime::addCenterFrequency(void) { // cente
PYLITH_JOURNAL_DEBUG("addCenterFrequency(void)");

const char* subfieldName = "center_frequency";
const PylithReal timeScale = _normalizer->getTimeScale();

pylith::topology::Field::Description description;
description.label = subfieldName;
Expand All @@ -58,7 +59,7 @@ pylith::sources::AuxiliaryFactorySourceTime::addCenterFrequency(void) { // cente
description.numComponents = 1;
description.componentNames.resize(1);
description.componentNames[0] = subfieldName;
description.scale = 1.0;
description.scale = 1.0 / timeScale;
description.validator = pylith::topology::FieldQuery::validatorNonnegative;

_field->subfieldAdd(description, getSubfieldDiscretization(subfieldName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pylith::sources::TestAuxiliaryFactoryMomentTensorForce::TestAuxiliaryFactoryMome
info.fe = pylith::topology::Field::Discretization(
2, 2, _data->auxDim, _data->auxDim, false, pylith::topology::Field::DEFAULT_BASIS, pylith::topology::Field::POLYNOMIAL_SPACE, false
);
info.index = 3;
info.index = 0;
_data->subfields["moment_tensor"] = info;
if (2 == _data->auxDim) {
_data->subfields["moment_tensor"].description.numComponents = 4;
Expand All @@ -94,7 +94,7 @@ pylith::sources::TestAuxiliaryFactoryMomentTensorForce::TestAuxiliaryFactoryMome
info.fe = pylith::topology::Field::Discretization(
1, 2, _data->auxDim, 1, false, pylith::topology::Field::DEFAULT_BASIS, pylith::topology::Field::POLYNOMIAL_SPACE, true
);
info.index = 0;
info.index = 1;
_data->subfields["time_delay"] = info;

_initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class pylith::sources::TestAuxiliaryFactoryMomentTensorForce_Cases {
}

static
const char* pressure_units(void) {
const char* moment_tensor_units(void) {
return "Pa";
} // pressure_units
} // moment_tensor_units

static
double time_delay_2d(const double x,
Expand Down Expand Up @@ -166,10 +166,10 @@ pylith::sources::TestAuxiliaryFactoryMomentTensorForce_Cases::Tri(void) {
data->cs->setSpaceDim(data->dimension);

assert(data->auxiliaryDB);
data->auxiliaryDB->addValue("moment_tensor_xx", moment_tensor_2d_xx, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_yy", moment_tensor_2d_yy, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_zz", moment_tensor_2d_zz, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_xy", moment_tensor_2d_xy, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_xx", moment_tensor_2d_xx, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_yy", moment_tensor_2d_yy, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_zz", moment_tensor_2d_zz, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_xy", moment_tensor_2d_xy, moment_tensor_units());
data->auxiliaryDB->addValue("time_delay", time_delay_2d, time_units());
data->auxiliaryDB->setDescription("auxiliary");
data->auxiliaryDB->setCoordSys(*data->cs);
Expand All @@ -191,12 +191,12 @@ pylith::sources::TestAuxiliaryFactoryMomentTensorForce_Cases::Hex(void) {
data->cs->setSpaceDim(data->dimension);

assert(data->auxiliaryDB);
data->auxiliaryDB->addValue("moment_tensor_xx", moment_tensor_3d_xx, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_yy", moment_tensor_3d_yy, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_zz", moment_tensor_3d_zz, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_xy", moment_tensor_3d_xy, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_yz", moment_tensor_3d_yz, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_xz", moment_tensor_3d_xz, pressure_units());
data->auxiliaryDB->addValue("moment_tensor_xx", moment_tensor_3d_xx, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_yy", moment_tensor_3d_yy, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_zz", moment_tensor_3d_zz, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_xy", moment_tensor_3d_xy, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_yz", moment_tensor_3d_yz, moment_tensor_units());
data->auxiliaryDB->addValue("moment_tensor_xz", moment_tensor_3d_xz, moment_tensor_units());
data->auxiliaryDB->addValue("time_delay", time_delay_3d, time_units());
data->auxiliaryDB->setDescription("auxiliary");
data->auxiliaryDB->setCoordSys(*data->cs);
Expand Down
6 changes: 3 additions & 3 deletions tests/libtests/sources/TestAuxiliaryFactorySourceTime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pylith::sources::TestAuxiliaryFactorySourceTime::TestAuxiliaryFactorySourceTime(
info.fe = pylith::topology::Field::Discretization(
2, 2, _data->auxDim, _data->auxDim, false, pylith::topology::Field::DEFAULT_BASIS, pylith::topology::Field::POLYNOMIAL_SPACE, false
);
info.index = 3;
info.index = 0;
_data->subfields["moment_tensor"] = info;
if (2 == _data->auxDim) {
_data->subfields["moment_tensor"].description.numComponents = 4;
Expand All @@ -95,7 +95,7 @@ pylith::sources::TestAuxiliaryFactorySourceTime::TestAuxiliaryFactorySourceTime(
info.fe = pylith::topology::Field::Discretization(
1, 2, _data->auxDim, 1, false, pylith::topology::Field::DEFAULT_BASIS, pylith::topology::Field::POLYNOMIAL_SPACE, true
);
info.index = 0;
info.index = 1;
_data->subfields["time_delay"] = info;

// centerFrequency
Expand All @@ -113,7 +113,7 @@ pylith::sources::TestAuxiliaryFactorySourceTime::TestAuxiliaryFactorySourceTime(
info.fe = pylith::topology::Field::Discretization(
2, 2, _data->auxDim, 1, false, pylith::topology::Field::DEFAULT_BASIS, pylith::topology::Field::POLYNOMIAL_SPACE, true
);
info.index = 0;
info.index = 2;
_data->subfields["center_frequency"] = info;

_initialize();
Expand Down

0 comments on commit 440fd67

Please sign in to comment.