[aspect-devel] Material models with 3-D ASCII input

Wolfgang Bangerth bangerth at colostate.edu
Tue Jan 30 20:15:40 PST 2018


Marie,

> class XXXXX: public MaterialModel::Interface<dim>, public 
> ::aspect::SimulatorAccess<dim>, public Utilities::AsciiDataInitial<dim>
> 
> 
> but it turns out that Utilities::AsciiDataInitial already inherits from the 
> SimulatorAccess class, so this coding attempt gave me errors about 
> SimulatorAccess functions being inaccessible due to ambiguity. I'm very rusty 
> when it comes to inheritance and pointers, so I'm here to ask some questions...
> 
> 
> 1. Can I just remove SimulatorAccess as a public member of my class template 
> to resolve this ambiguity? This seems like a bad idea, but I don't know enough 
> about ASPECT's internal workings to be sure.

Yes, this will work. Another option would be to make the AsciiDataInitial 
class a *member variable*, rather than a base class. Presumably you do it the 
way you show above because you want to access the elements of the 
AsciiDataInitial member functions from the evaluate() function of your 
material model. But you can also achieve this by making the AsciiDataInitial 
thing a member.

In fact, this may be the cleaner approach: inheritance denotes an "is a" 
relationship:
   https://en.wikipedia.org/wiki/Is-a
I'm not sure you want to say that your material model "is a" AsciiDataInitial 
thing. It *uses* such a thing, however.


> 2. Why does <include/aspect/material_model/ascii_reference_profile.h> store 
> the ASCII data in an object called 'profile' instead of declaring 
> Utilities::AsciiDataProfile as a public member? So it ends up calling 
> functions like "profile.initialize(XXX)" instead of 
> "Utilities::AsciiDataProfile::initialize(XXX)", for example.

I don't remember who actually wrote this class, but I'll let them answer this.


> 3. I tried to mimic the above approach in my own code as well, putting 
> "aspect::Utilities::AsciiDataInitial<dim> field" in the private header and 
> "field.initialize(1)" in the initialize function of my material model, and so 
> on. But unlike AsciiDataProfile, the initialize function of AsciiDataInitial 
> contains 'this' pointers that end up pointing nowhere and giving me "address 
> not mapped" errors. Again, I'm not an expert on pointers... Could I fix this 
> problem without altering the source code, or is this just a bad approach?

I think you'd have to show us exactly how you did this in your code.

Best
  W.

-- 
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bangerth at colostate.edu
                            www: http://www.math.colostate.edu/~bangerth/



More information about the Aspect-devel mailing list