Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Add empty constructors to RBF interpolation classes #228

Merged
merged 1 commit into from
Apr 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/RBFMeshMotionSolver/RBFCoarsening.C
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@ namespace rbf
{
Foam::debug::debugSwitch RBFCoarsening::debug( "RBFInterpolation", 0 );

RBFCoarsening::RBFCoarsening()
:
rbf( std::shared_ptr<RBFInterpolation> ( new RBFInterpolation() ) ),
rbfCoarse( std::shared_ptr<RBFInterpolation> ( new RBFInterpolation( rbf->rbfFunction, rbf->polynomialTerm, rbf->cpu ) ) ),
enabled( false ),
livePointSelection( false ),
livePointSelectionSumValues( false ),
tol( 0 ),
tolLivePointSelection( 0 ),
coarseningMinPoints( 0 ),
coarseningMaxPoints( 0 ),
twoPointSelection( false ),
surfaceCorrection( false ),
ratioRadiusError( 10 ),
exportTxt( false ),
selectedPositions(),
nbStaticFaceCentersRemove( 0 ),
positions(),
positionsInterpolation(),
values(),
errorInterpolationCoarse(),
closestBoundaryIndexCorrection(),
valuesCorrection(),
nbMovingFaceCenters( 0 ),
fileExportIndex( 0 )
{
assert( rbf );
}

RBFCoarsening::RBFCoarsening( std::shared_ptr<RBFInterpolation> rbf )
:
rbf( rbf ),
Expand Down
2 changes: 2 additions & 0 deletions src/RBFMeshMotionSolver/RBFCoarsening.H
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace rbf
class RBFCoarsening
{
public:
RBFCoarsening();

explicit RBFCoarsening( std::shared_ptr<RBFInterpolation> rbf );

RBFCoarsening(
Expand Down
17 changes: 17 additions & 0 deletions src/RBFMeshMotionSolver/RBFInterpolation.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,26 @@
*/

#include "RBFInterpolation.H"
#include "TPSFunction.H"

namespace rbf
{
RBFInterpolation::RBFInterpolation()
:
rbfFunction( std::shared_ptr<RBFFunctionInterface> ( new TPSFunction() ) ),
polynomialTerm( true ),
cpu( false ),
computed( false ),
n_A( 0 ),
n_B( 0 ),
dimGrid( 0 ),
Hhat(),
Phi(),
lu(),
positions(),
positionsInterpolation()
{}

RBFInterpolation::RBFInterpolation( std::shared_ptr<RBFFunctionInterface> rbfFunction )
:
rbfFunction( rbfFunction ),
Expand Down
2 changes: 2 additions & 0 deletions src/RBFMeshMotionSolver/RBFInterpolation.H
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace rbf
class RBFInterpolation
{
public:
RBFInterpolation();

explicit RBFInterpolation( std::shared_ptr<RBFFunctionInterface> rbfFunction );

RBFInterpolation(
Expand Down
35 changes: 35 additions & 0 deletions src/fsi/MultiLevelSolver.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@

namespace fsi
{
MultiLevelSolver::MultiLevelSolver(
shared_ptr<BaseMultiLevelSolver> solver,
shared_ptr<BaseMultiLevelSolver> couplingGridSolver,
int participantId,
int level
)
:
solver( solver ),
couplingGridSolver( couplingGridSolver ),
rbfInterpToCouplingMesh( shared_ptr<RBFCoarsening> ( new RBFCoarsening() ) ),
rbfInterpToMesh( shared_ptr<RBFCoarsening> ( new RBFCoarsening() ) ),
participantId( participantId ),
level( level ),
couplingGridSize( 0 )
{
assert( solver );
assert( couplingGridSolver );
assert( participantId == 0 || participantId == 1 );
assert( level >= 0 );
assert( rbfInterpToCouplingMesh );
assert( rbfInterpToMesh );

matrix couplingGridPositions;

if ( participantId == 0 )
couplingGridSolver->getWritePositions( couplingGridPositions );

if ( participantId == 1 )
couplingGridSolver->getReadPositions( couplingGridPositions );

couplingGridSize = couplingGridPositions.rows();

assert( couplingGridSize > 0 );
}

MultiLevelSolver::MultiLevelSolver(
shared_ptr<BaseMultiLevelSolver> solver,
shared_ptr<BaseMultiLevelSolver> couplingGridSolver,
Expand Down
7 changes: 7 additions & 0 deletions src/fsi/MultiLevelSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ namespace fsi
class MultiLevelSolver
{
public:
MultiLevelSolver(
shared_ptr<BaseMultiLevelSolver> solver,
shared_ptr<BaseMultiLevelSolver> couplingGridSolver,
int participantId,
int level
);

MultiLevelSolver(
shared_ptr<BaseMultiLevelSolver> solver,
shared_ptr<BaseMultiLevelSolver> couplingGridSolver,
Expand Down
32 changes: 3 additions & 29 deletions src/tests/testsuite-sdc-fsi/test_sdcexplicitsolidsolver.C
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,10 @@ class SDCFsiExplicitSolidSolverTest : public ::testing::Test
int minIter = 5;

std::shared_ptr<tubeflow::SDCTubeFlowFluidSolver> fluid( new tubeflow::SDCTubeFlowFluidSolver( a0, u0, p0, dt, cmk, N, L, T, rho_f ) );
std::shared_ptr<fsi::BaseMultiLevelSolver> solid( new tubeflow::SDCTubeFlowExplicitLinearSolidSolver( N, nu, rho_s, h, L, dt, G, E0, r0, p0, T ) );

std::shared_ptr<fsi::BaseMultiLevelSolver> solid;
solid = std::shared_ptr<fsi::BaseMultiLevelSolver>( new tubeflow::SDCTubeFlowExplicitLinearSolidSolver( N, nu, rho_s, h, L, dt, G, E0, r0, p0, T ) );

assert( solid );

shared_ptr<RBFFunctionInterface> rbfFunction;
shared_ptr<RBFInterpolation> rbfInterpolator;
shared_ptr<RBFCoarsening> rbfInterpToCouplingMesh;
shared_ptr<RBFCoarsening> rbfInterpToMesh;

rbfFunction = shared_ptr<RBFFunctionInterface>( new TPSFunction() );
rbfInterpolator = shared_ptr<RBFInterpolation>( new RBFInterpolation( rbfFunction ) );
rbfInterpToCouplingMesh = shared_ptr<RBFCoarsening> ( new RBFCoarsening( rbfInterpolator ) );

rbfFunction = shared_ptr<RBFFunctionInterface>( new TPSFunction() );
rbfInterpolator = shared_ptr<RBFInterpolation>( new RBFInterpolation( rbfFunction ) );
rbfInterpToMesh = shared_ptr<RBFCoarsening> ( new RBFCoarsening( rbfInterpolator ) );

shared_ptr<MultiLevelSolver> fluidSolver( new MultiLevelSolver( fluid, fluid, rbfInterpToCouplingMesh, rbfInterpToMesh, 0, 0 ) );

rbfFunction = shared_ptr<RBFFunctionInterface>( new TPSFunction() );
rbfInterpolator = shared_ptr<RBFInterpolation>( new RBFInterpolation( rbfFunction ) );
rbfInterpToCouplingMesh = shared_ptr<RBFCoarsening> ( new RBFCoarsening( rbfInterpolator ) );

rbfFunction = shared_ptr<RBFFunctionInterface>( new TPSFunction() );
rbfInterpolator = shared_ptr<RBFInterpolation>( new RBFInterpolation( rbfFunction ) );
rbfInterpToMesh = shared_ptr<RBFCoarsening> ( new RBFCoarsening( rbfInterpolator ) );

shared_ptr<MultiLevelSolver> solidSolver( new MultiLevelSolver( solid, fluid, rbfInterpToCouplingMesh, rbfInterpToMesh, 1, 0 ) );
shared_ptr<MultiLevelSolver> fluidSolver( new MultiLevelSolver( fluid, fluid, 0, 0 ) );
shared_ptr<MultiLevelSolver> solidSolver( new MultiLevelSolver( solid, fluid, 1, 0 ) );

std::shared_ptr< std::list<std::shared_ptr<ConvergenceMeasure> > > convergenceMeasures;
convergenceMeasures = std::shared_ptr<std::list<std::shared_ptr<ConvergenceMeasure> > >( new std::list<std::shared_ptr<ConvergenceMeasure> > );
Expand Down