Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rwalkerlewis committed Nov 23, 2023
1 parent 0b3e256 commit ccb94d9
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 21 deletions.
2 changes: 2 additions & 0 deletions tests/libtests/sources/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
110 changes: 110 additions & 0 deletions tests/libtests/sources/TestAuxiliaryFactoryWellboreSource.hh
Original file line number Diff line number Diff line change
@@ -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 <map> // 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<std::string, pylith::topology::Field::SubfieldInfo> 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
40 changes: 20 additions & 20 deletions tests/libtests/sources/TestAuxiliaryFactoryWellboreSource_Cases.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

#include <portinfo>

#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
Expand All @@ -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:

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit ccb94d9

Please sign in to comment.