Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MoReFEM
CoreLibrary
MoReFEM
Commits
d32bb775
Commit
d32bb775
authored
Mar 30, 2016
by
GILLES Sebastien
Browse files
#873
Parameter/time dependency: set up a dedicated test.
parent
79b1dd9d
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Data/Lua/demo_input_test_parameter_time_dependency.lua
0 → 100644
View file @
d32bb775
This diff is collapsed.
Click to expand it.
HappyHeart.xcodeproj/project.pbxproj
View file @
d32bb775
...
...
@@ -15587,6 +15587,7 @@
"-lyuni-static-core",
"-lmpi",
"-lpetsc",
"-lmpi_cxx",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
...
...
@@ -15612,6 +15613,7 @@
"-lyuni-static-core",
"-lmpi",
"-lpetsc",
"-lmpi_cxx",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
Sources/Test/Parameter/TimeDependency/InputParameterList.hpp
0 → 100644
View file @
d32bb775
//
// InputParameterList.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 28/07/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_INPUT_PARAMETER_LIST_HPP_
# define HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_INPUT_PARAMETER_LIST_HPP_
# include "Utilities/Containers/EnumClass.hpp"
# include "Core/InputParameterData/InputParameterList.hpp"
# include "Core/InputParameter/Geometry/Domain.hpp"
# include "Core/InputParameter/FElt/FEltSpace.hpp"
# include "Core/InputParameter/FElt/Unknown.hpp"
# include "Core/InputParameter/FElt/NumberingSubset.hpp"
# include "Core/InputParameter/Parameter/Solid/Solid.hpp"
namespace
HappyHeart
{
namespace
TestParameterTimeDependencyNS
{
enum
class
MeshIndex
{
mesh
=
1
};
enum
class
DomainIndex
{
domain
=
1
};
enum
class
FEltSpaceIndex
{
index
=
1
};
enum
class
UnknownIndex
{
scalar
=
1
,
vectorial
=
2
};
enum
class
SolverIndex
{
solver
=
1
};
enum
class
NumberingSubsetIndex
{
scalar
=
1
,
vectorial
=
2
};
using
InputParameterTuple
=
std
::
tuple
<
InputParameter
::
TimeManager
,
InputParameter
::
NumberingSubset
<
EnumUnderlyingType
(
NumberingSubsetIndex
::
scalar
)
>
,
InputParameter
::
NumberingSubset
<
EnumUnderlyingType
(
NumberingSubsetIndex
::
vectorial
)
>
,
InputParameter
::
Unknown
<
EnumUnderlyingType
(
UnknownIndex
::
scalar
)
>
,
InputParameter
::
Unknown
<
EnumUnderlyingType
(
UnknownIndex
::
vectorial
)
>
,
InputParameter
::
Mesh
<
EnumUnderlyingType
(
MeshIndex
::
mesh
)
>
,
InputParameter
::
Domain
<
EnumUnderlyingType
(
DomainIndex
::
domain
)
>
,
InputParameter
::
FEltSpace
<
EnumUnderlyingType
(
FEltSpaceIndex
::
index
)
>
,
InputParameter
::
Petsc
<
EnumUnderlyingType
(
SolverIndex
::
solver
)
>
,
InputParameter
::
Solid
,
InputParameter
::
Result
>
;
using
InputParameterList
=
InputParameterList
<
InputParameterTuple
>
;
}
// namespace TestParameterTimeDependencyNS
}
// namespace HappyHeart
#endif // HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_INPUT_PARAMETER_LIST_HPP_
Sources/Test/Parameter/TimeDependency/Model.cpp
0 → 100644
View file @
d32bb775
//
// Model.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 28/07/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include
"Core/InputParameter/Result.hpp"
#include
"Core/InputParameter/Parameter/Solid/Solid.hpp"
#include
"Core/ParameterType.hpp"
#include
"Parameters/Policy/AtDof.hpp"
#include
"Parameters/InitParameter.hpp"
#include
"Parameters/Private/ParameterInstance.hpp"
#include
"Operators/InterpolationOperatorInstances/ConformInterpolator.hpp"
#include
"Test/Parameter/TimeDependency/Model.hpp"
namespace
HappyHeart
{
namespace
TestParameterTimeDependencyNS
{
Model
::
Model
(
const
Wrappers
::
Mpi
&
mpi_ptr
,
const
InputParameterList
&
input_parameter_data
)
:
parent
(
mpi_ptr
,
input_parameter_data
),
output_directory_
(
Utilities
::
InputParameterListNS
::
Extract
<
InputParameter
::
Result
::
OutputDirectory
>::
Path
(
input_parameter_data
))
{
}
void
Model
::
SupplInitialize
(
const
InputParameterList
&
input_parameter_data
)
{
decltype
(
auto
)
mesh
=
GetGeometricMeshRegion
(
EnumUnderlyingType
(
MeshIndex
::
mesh
));
using
Solid
=
InputParameter
::
Solid
;
young_modulus_
=
InitScalarParameter
<
Solid
::
YoungModulus
,
ParameterNS
::
TimeDependencyNS
::
None
>
(
"Young modulus"
,
mesh
,
input_parameter_data
);
}
void
Model
::
Forward
()
{
std
::
cout
<<
"Young modulus = "
<<
GetYoungModulus
().
GetConstantValue
()
<<
std
::
endl
;
}
void
Model
::
SupplInitializeStep
()
{
}
void
Model
::
SupplFinalizeStep
()
{
}
void
Model
::
SupplFinalize
()
{
}
}
// namespace TestParameterTimeDependencyNS
}
// namespace HappyHeart
Sources/Test/Parameter/TimeDependency/Model.hpp
0 → 100644
View file @
d32bb775
//
// Model.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 28/07/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_MODEL_HPP_
# define HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_MODEL_HPP_
# include <memory>
# include <vector>
# include "Model/Model.hpp"
# include "Operators/ConformInterpolatorInstances/SubsetOrSuperset.hpp"
# include "Test/Parameter/TimeDependency/InputParameterList.hpp"
namespace
HappyHeart
{
namespace
TestParameterTimeDependencyNS
{
class
Model
:
public
HappyHeart
::
Model
<
Model
,
DoConsiderProcessorWiseLocal2Global
::
yes
>
{
private:
//! Alias to self.
using
self
=
Model
;
//! Convenient alias.
using
parent
=
HappyHeart
::
Model
<
Model
,
DoConsiderProcessorWiseLocal2Global
::
yes
>
;
public:
//! Return the name of the model.
static
const
std
::
string
&
ClassName
();
//! Friendship granted to the base class so this one can manipulates private methods.
friend
parent
;
public:
/// \name Special members.
///@{
//! Constructor.
Model
(
const
Wrappers
::
Mpi
&
mpi
,
const
InputParameterList
&
input_parameter_data
);
//! Destructor.
~
Model
()
=
default
;
//! Copy constructor.
Model
(
const
Model
&
)
=
delete
;
//! Move constructor.
Model
(
Model
&&
)
=
delete
;
//! Copy affectation.
Model
&
operator
=
(
const
Model
&
)
=
delete
;
//! Move affectation.
Model
&
operator
=
(
Model
&&
)
=
delete
;
///@}
/// \name Crtp-required methods.
///@{
/*!
* \brief Initialise the problem.
*
* This initialisation includes the resolution of the static problem.
*/
void
SupplInitialize
(
const
InputParameterList
&
input_parameter_data
);
//! Manage time iteration.
void
Forward
();
/*!
* \brief Additional operations to finalize a dynamic step.
*
* Base class already update the time for next time iterations.
*/
void
SupplFinalizeStep
();
/*!
* \brief Initialise a dynamic step.
*
*/
void
SupplFinalize
();
//! Output directory.
const
std
::
string
&
GetOutputDirectory
()
const
noexcept
;
private:
/*!
* \brief Whether the model wants to add additional cases in which the Model stops (besides the reach of
* maximum time).
*
* Returns always true (no such additional condition in this Model).
*/
bool
SupplHasFinishedConditions
()
const
;
/*!
* \brief Part of InitializedStep() specific to Elastic model.
*
* As there are none, the body of this method is empty.
*/
void
SupplInitializeStep
();
///@}
//! Constant accessor to the young modulus (i.e. scalar parameter)
const
ScalarParameter
<>&
GetYoungModulus
()
const
noexcept
;
//! Non constant accessor to the young modulus (i.e. scalar parameter)
ScalarParameter
<>&
GetNonCstYoungModulus
()
noexcept
;
private:
//! Output directory.
const
std
::
string
output_directory_
;
//! Young modulus (i.e. scalar parameter)
ScalarParameter
<>::
const_unique_ptr
young_modulus_
=
nullptr
;
};
}
// namespace TestParameterTimeDependencyNS
}
// namespace HappyHeart
# include "Test/Parameter/TimeDependency/Model.hxx"
#endif // HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_MODEL_HPP_
Sources/Test/Parameter/TimeDependency/Model.hxx
0 → 100644
View file @
d32bb775
//
// Model.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 28/07/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_MODEL_HXX_
# define HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_MODEL_HXX_
namespace
HappyHeart
{
namespace
TestParameterTimeDependencyNS
{
inline
const
std
::
string
&
Model
::
ClassName
()
{
static
std
::
string
name
(
"ParameterTimeDependency"
);
return
name
;
}
inline
bool
Model
::
SupplHasFinishedConditions
()
const
{
return
false
;
// ie no additional condition
}
inline
const
std
::
string
&
Model
::
GetOutputDirectory
()
const
noexcept
{
return
output_directory_
;
}
inline
const
ScalarParameter
<>&
Model
::
GetYoungModulus
()
const
noexcept
{
assert
(
!
(
!
young_modulus_
));
return
*
young_modulus_
;
}
inline
ScalarParameter
<>&
Model
::
GetNonCstYoungModulus
()
noexcept
{
return
const_cast
<
ScalarParameter
<>&>
(
GetYoungModulus
());
}
}
// namespace TestParameterTimeDependencyNS
}
// namespace HappyHeart
#endif // HAPPY_HEART_x_TEST_x_PARAMETER_x_TIME_DEPENDENCY_x_MODEL_HXX_
Sources/Test/Parameter/TimeDependency/main.cpp
0 → 100644
View file @
d32bb775
//
// main.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 28/07/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include
<cstdlib>
#include
"Utilities/Exceptions/PrintAndAbort.hpp"
#include
"Core/InitHappyHeart.hpp"
#include
"Test/Parameter/TimeDependency/Model.hpp"
#include
"Test/Parameter/TimeDependency/InputParameterList.hpp"
using
namespace
HappyHeart
;
int
main
(
int
argc
,
char
**
argv
)
{
using
InputParameterList
=
TestParameterTimeDependencyNS
::
InputParameterList
;
try
{
InitHappyHeart
<
InputParameterList
>
happy_heart
(
argc
,
argv
);
const
auto
&
input_parameter_data
=
happy_heart
.
GetInputParameterList
();
const
auto
&
mpi
=
happy_heart
.
GetMpi
();
try
{
TestParameterTimeDependencyNS
::
Model
model
(
mpi
,
input_parameter_data
);
model
.
Run
(
input_parameter_data
);
input_parameter_data
.
PrintUnused
(
std
::
cout
);
}
catch
(
const
std
::
exception
&
e
)
{
ExceptionNS
::
PrintAndAbort
(
mpi
,
e
.
what
());
}
catch
(
Seldon
::
Error
&
e
)
{
ExceptionNS
::
PrintAndAbort
(
mpi
,
e
.
What
());
}
}
catch
(
const
std
::
exception
&
e
)
{
std
::
ostringstream
oconv
;
oconv
<<
"Exception caught from InitHappyHeart<InputParameterList>: "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
oconv
.
str
();
return
EXIT_FAILURE
;
}
return
EXIT_SUCCESS
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment