From ccb94d91c3e714afdd89963ef8ee7d1f1688cf3e Mon Sep 17 00:00:00 2001 From: Robert Walker Date: Thu, 23 Nov 2023 10:54:38 -0700 Subject: [PATCH] Minor changes --- tests/libtests/sources/Makefile.am | 2 + .../TestAuxiliaryFactoryWellboreSource.cc | 3 +- .../TestAuxiliaryFactoryWellboreSource.hh | 110 ++++++++++++++++++ ...estAuxiliaryFactoryWellboreSource_Cases.cc | 40 +++---- 4 files changed, 134 insertions(+), 21 deletions(-) create mode 100644 tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.hh diff --git a/tests/libtests/sources/Makefile.am b/tests/libtests/sources/Makefile.am index 2c77df89ac..83dcec56b9 100644 --- a/tests/libtests/sources/Makefile.am +++ b/tests/libtests/sources/Makefile.am @@ -32,6 +32,8 @@ libtest_sources_SOURCES = \ TestAuxiliaryFactorySourceTime_Cases.cc \ TestAuxiliaryFactoryPointForce.cc \ TestAuxiliaryFactoryPointForce_Cases.cc \ + TestAuxiliaryFactoryWellboreSource.cc \ + TestAuxiliaryFactoryWellboreSource_Cases.cc \ $(top_srcdir)/tests/src/FieldTester.cc \ $(top_srcdir)/tests/src/driver_catch2.cc diff --git a/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.cc b/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.cc index a6cc2dba6b..9e4f72c9b1 100644 --- a/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.cc +++ b/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.cc @@ -265,8 +265,9 @@ pylith::sources::TestAuxiliaryFactoryWellboreSource::testAdd(void) { _factory->addIsotropicPermeability(); _factory->addWellboreRadius(); _factory->addWellboreLength(); + _factory->addWellboreCharacter(); + _factory->addElementDimensions(); _factory->addTimeDelay(); - _factory->addCenterFrequency(); assert(_data->normalizer); diff --git a/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.hh b/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.hh new file mode 100644 index 0000000000..efe8897499 --- /dev/null +++ b/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.hh @@ -0,0 +1,110 @@ +// -*- C++ -*- +// +// ---------------------------------------------------------------------- +// +// Brad T. Aagaard, U.S. Geological Survey +// Charles A. Williams, GNS Science +// Matthew G. Knepley, University at Buffalo +// Robert L. Walker, Kegman, Inc. +// +// This code was developed as part of the Computational Infrastructure +// for Geodynamics (http://geodynamics.org). +// +// Copyright (c) 2010-2022 University of California, Davis +// +// See LICENSE.md for license information. +// +// ---------------------------------------------------------------------- +// + +/** + * @file tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.hh + * + * @brief C++ TestAuxiliaryFactoryWellboreSource object. + * + * C++ unit testing for AuxiliaryFactoryWellboreSource. + */ + +#if !defined(pylith_sources_testauxiliaryfactorywellboresource_hh) +#define pylith_sources_testauxiliaryfactorywellboresource_hh + +#include "pylith/utils/GenericComponent.hh" // ISA GenericComponent + +#include "pylith/sources/sourcesfwd.hh" // HOLDSA AuxiliaryFactoryWellboreSource +#include "pylith/topology/Field.hh" // HOLDSA Field::SubfieldInfo +#include "spatialdata/spatialdb/spatialdbfwd.hh" // HOLDSA SpatialDB +#include "spatialdata/geocoords/geocoordsfwd.hh" // HOLDSA Coordsys +#include "spatialdata/units/unitsfwd.hh" // HOLDSA Nondimensional + +#include // USES std::map + +namespace pylith { + namespace sources { + class TestAuxiliaryFactoryWellboreSource; + class TestAuxiliaryFactoryWellboreSource_Data; + } // sources +} // pylith + +// ------------------------------------------------------------------------------------------------ +class pylith::sources::TestAuxiliaryFactoryWellboreSource : public pylith::utils::GenericComponent { + // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////// +public: + + /// Constructor. + TestAuxiliaryFactoryWellboreSource(TestAuxiliaryFactoryWellboreSource_Data* data); + + /// Destructor. + ~TestAuxiliaryFactoryWellboreSource(void); + + /// Test adding density, body force, and gravity subfields. + void testAdd(void); + + /// Test setValuesFromDB(). + void testSetValuesFromDB(void); + + // PROTECTED METHODS ////////////////////////////////////////////////////////////////////////// +protected: + + /// Initialze mesh, coordinate system, auxiliary field, and factory. + void _initialize(void); + + // PROTECTED MEMBERS ////////////////////////////////////////////////////////////////////////// +protected: + + AuxiliaryFactoryWellboreSource* _factory; ///< Test subject. + TestAuxiliaryFactoryWellboreSource_Data* _data; ///< Test data. + + pylith::topology::Mesh* _mesh; ///< Finite-element mesh. + pylith::topology::Field* _auxiliaryField; ///< Auxiliary field for test subject. + +}; // class TestAuxiliaryFactoryWellboreSource + +// ------------------------------------------------------------------------------------------------ +class pylith::sources::TestAuxiliaryFactoryWellboreSource_Data { + // PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////// +public: + + /// Constructor + TestAuxiliaryFactoryWellboreSource_Data(void); + + /// Destructor + ~TestAuxiliaryFactoryWellboreSource_Data(void); + + // PUBLIC MEMBERS ///////////////////////////////////////////////////////////////////////////// +public: + + size_t dimension; ///< Spatial dimension. + size_t auxDim; ///< Topological dimension of auxiliary field. + const char* meshFilename; ///< Name of file with ASCII mesh. + spatialdata::geocoords::CoordSys* cs; ///< Coordinate system. + spatialdata::units::Nondimensional* normalizer; ///< Scales for nondimensionalization. + + std::map subfields; + spatialdata::spatialdb::UserFunctionDB* auxiliaryDB; ///< Spatial database with values for solution. + spatialdata::spatialdb::GravityField* gravityField; ///< Gravity field spatial database. + +}; // class TestAuxiliaryFactoryWellboreSource_Data + +#endif // pylith_sources_testAuxiliaryFactoryWellboreSource_hh + +// End of file diff --git a/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource_Cases.cc b/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource_Cases.cc index 797822affe..b55a649134 100644 --- a/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource_Cases.cc +++ b/tests/libtests/sources/TestAuxiliaryFactoryWellboreSource_Cases.cc @@ -18,9 +18,9 @@ #include -#include "TestAuxiliaryFactorySourceTime.hh" // Implementation of cases +#include "TestAuxiliaryFactoryWellboreSource.hh" // Implementation of cases -#include "pylith/sources/AuxiliaryFactorySourceTime.hh" // USES AuxiliaryFactorySourceTime +#include "pylith/sources/AuxiliaryFactoryWellboreSource.hh" // USES AuxiliaryFactoryWellboreSource #include "spatialdata/geocoords/CSCart.hh" // USES CSCart #include "spatialdata/spatialdb/UserFunctionDB.hh" // USES UserFunctionDB #include "spatialdata/units/Nondimensional.hh" // USES Nondimensional @@ -32,18 +32,18 @@ // forward declarations namespace pylith { namespace sources { - class TestAuxiliaryFactorySourceTime_Cases; + class TestAuxiliaryFactoryWellboreSource_Cases; } // sources } // pylith // ------------------------------------------------------------------------------------------------ -class pylith::sources::TestAuxiliaryFactorySourceTime_Cases { +class pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases { public: // Data factory methods - static TestAuxiliaryFactorySourceTime_Data* Tri(void); + static TestAuxiliaryFactoryWellboreSource_Data* Tri(void); - static TestAuxiliaryFactorySourceTime_Data* Hex(void); + static TestAuxiliaryFactoryWellboreSource_Data* Hex(void); private: @@ -186,24 +186,24 @@ class pylith::sources::TestAuxiliaryFactorySourceTime_Cases { }; // ------------------------------------------------------------------------------------------------ -TEST_CASE("TestAuxiliaryFactorySourceTime::Tri::testAdd", "[TestAuxiliaryFactorySourceTime][add]") { - pylith::sources::TestAuxiliaryFactorySourceTime(pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Tri()).testAdd(); +TEST_CASE("TestAuxiliaryFactoryWellboreSource::Tri::testAdd", "[TestAuxiliaryFactoryWellboreSource][add]") { + pylith::sources::TestAuxiliaryFactoryWellboreSource(pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases::Tri()).testAdd(); } -TEST_CASE("TestAuxiliaryFactorySourceTime::Tri::testSetValuesFromDB", "[TestAuxiliaryFactorySourceTime][testSetValuesFromDB]") { - pylith::sources::TestAuxiliaryFactorySourceTime(pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Tri()).testSetValuesFromDB(); +TEST_CASE("TestAuxiliaryFactoryWellboreSource::Tri::testSetValuesFromDB", "[TestAuxiliaryFactoryWellboreSource][testSetValuesFromDB]") { + pylith::sources::TestAuxiliaryFactoryWellboreSource(pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases::Tri()).testSetValuesFromDB(); } -TEST_CASE("TestAuxiliaryFactorySourceTime::Hex::testAdd", "[TestAuxiliaryFactorySourceTime][add]") { - pylith::sources::TestAuxiliaryFactorySourceTime(pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Hex()).testAdd(); +TEST_CASE("TestAuxiliaryFactoryWellboreSource::Hex::testAdd", "[TestAuxiliaryFactoryWellboreSource][add]") { + pylith::sources::TestAuxiliaryFactoryWellboreSource(pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases::Hex()).testAdd(); } -TEST_CASE("TestAuxiliaryFactorySourceTime::Hex::testSetValuesFromDB", "[TestAuxiliaryFactorySourceTime][testSetValuesFromDB]") { - pylith::sources::TestAuxiliaryFactorySourceTime(pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Hex()).testSetValuesFromDB(); +TEST_CASE("TestAuxiliaryFactoryWellboreSource::Hex::testSetValuesFromDB", "[TestAuxiliaryFactoryWellboreSource][testSetValuesFromDB]") { + pylith::sources::TestAuxiliaryFactoryWellboreSource(pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases::Hex()).testSetValuesFromDB(); } // -------------------------------------------------------------------------------------------------------------------- -pylith::sources::TestAuxiliaryFactorySourceTime_Data* -pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Tri(void) { - pylith::sources::TestAuxiliaryFactorySourceTime_Data* data = new pylith::sources::TestAuxiliaryFactorySourceTime_Data(); +pylith::sources::TestAuxiliaryFactoryWellboreSource_Data* +pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases::Tri(void) { + pylith::sources::TestAuxiliaryFactoryWellboreSource_Data* data = new pylith::sources::TestAuxiliaryFactoryWellboreSource_Data(); assert(data); data->auxDim = 2; @@ -227,9 +227,9 @@ pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Tri(void) { // ------------------------------------------------------------------------------------------------ -pylith::sources::TestAuxiliaryFactorySourceTime_Data* -pylith::sources::TestAuxiliaryFactorySourceTime_Cases::Hex(void) { - pylith::sources::TestAuxiliaryFactorySourceTime_Data* data = new pylith::sources::TestAuxiliaryFactorySourceTime_Data(); +pylith::sources::TestAuxiliaryFactoryWellboreSource_Data* +pylith::sources::TestAuxiliaryFactoryWellboreSource_Cases::Hex(void) { + pylith::sources::TestAuxiliaryFactoryWellboreSource_Data* data = new pylith::sources::TestAuxiliaryFactoryWellboreSource_Data(); assert(data); data->auxDim = 3;