Skip to content

Creating a state variable with size that can be modified after compilation #574

Answered by thelfer
mhpierre asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @LordKthulhu,
No, you can't do that, as it would break many optimisation strategies in MFront.

However, you can do this:

@DSL Default;
@Behaviour @behaviour@;
@IntegerConstant Len = @nprops@;
@MaterialProperty real mat_prop[Len];
@StateVariable real state_var[Len];

@Integrator{}

and compile it this way:

$ mfront --interface=generic --@behaviour@=example3 --@nprops@=3 test.mfront
$ mfront --interface=generic --@behaviour@=example2 --@nprops@=2 test.mfront
$ mfront --obuild
The following library has been built :
- libBehaviour.so :  example3_AxisymmetricalGeneralisedPlaneStrain example3_Axisymmetrical example3_PlaneStrain example3_GeneralisedPlaneStrain example3_Tridimensional example2_…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mhpierre
Comment options

@thelfer
Comment options

Answer selected by mhpierre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants