Author Topic: No virtual methods in the ResidualBasedNewtonRaphsonStrategy  (Read 272 times)

vmataix

  • Newbie
  • *
  • Posts: 31
Hi,

I am trying to create my own strategy for the contact computation. The only difference respect the ResidualBasedNewtonRaphsonStrategy will be the use of the predict to be able to compute the ACTIVE/INACTIVE set, for that I tried to derive it from ResidualBasedNewtonRaphsonStrategy. The problem is that the original Newton Raphson has not any virtual method, which means that right now basically I copy paste the original. This is not the correct way to implement a strategy which is almost equal to the original one.

My question is if we avoid the virtual methods for performance reasons or it is just that in that moment nobody thought about the possibility of derive the strategy. If performance is not a problem for me will be very useful to derive my strategy from the one in the core. Otherwise, any recommendation for avoid as much as possible the copy paste of the code?

Best  regards

Josep Maria

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 50
Re: No virtual methods in the ResidualBasedNewtonRaphsonStrategy
« Reply #1 on: July 25, 2016, 12:07:34 AM »
Hi Vicente,

    I think that you can call the methods separatly:
   
    virtual double Solve()
    {
                Initialize();
                InitializeSolutionStep();
                Predict();                          "I would prefer to have Predict before InitializeSolutionStep..." 
                SolveSolutionStep();
                FinalizeSolutionStep();
        return 0.00;
    }

    So you can do something new between them whitout duplicating anything. 
You can also think about doing it in the scheme instead of the strategy.
The common options are to use an embeded or a rotational contact scheme.

BR


« Last Edit: July 26, 2016, 11:33:24 PM by Josep Maria »