FEAP User Forum

FEAP => FEAPpv => Topic started by: adil on December 17, 2015, 05:56:06 PM

Title: need help with FEAPpv pgetd to get mesh coordinates
Post by: adil on December 17, 2015, 05:56:06 PM
Hello, i'm trying to make a simple (partial) user interface for FEAPpv, as part of this i need to retrieve mesh
and results from feap study
NB: i use c++;
i use the input file :Iblock.txt (exemple i downloaded from feap website)
the problem is that when i use pgetd :

(see page 19 of programer manual :
The subroutine PGETD also may be used to retrieve internal data arrays by NAME for use
in user developed modules. For example, if a development requires the nodal coordinate
data the call
integer xpoint, xlen, xpre
logical flag
....
call pgetd ('X ',xpoint,xlen,xpre,flag)

this is what i get when i output the result of this command to a text file:

x.txt:

          25         -12           2 T   0.0000000000000000     
 ____________________________________________
 ____________________________________________


as you can see the number of cordinates (lengt    - Length of array) = -12 which is wrong
and when i output coordinates they are all equal to zero (see attachment 1.png) which is wrong too;

as an alternative i tried to get values using:

        double x = m_hr[pointer_.np[43]+i];
        double y = m_hr[pointer_.np[43]+i*2];


but i don't get the right coordinates(see attachment 2.png)



Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: Prof. R.L. Taylor on December 17, 2015, 06:43:41 PM
If pointers are integer*8 then "xpoint" must also be integer*8  or integer (kind=8) :: xpoint

Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: adil on December 18, 2015, 07:20:47 AM
hello;
i have changed the type of all integer in c++ file to int32_t which is supposed to be equivalent to integer  (kind=8) in fortran ; and i use double type in c++ in stead of real*8 but i get always the same result : lengt = -12; and all coordinates are 0;
thank you
Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: Prof. R.L. Taylor on December 18, 2015, 07:37:41 AM
OK, we will test the function to see if there is an error -- it is not often used.
Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: Prof. R.L. Taylor on December 18, 2015, 07:42:30 AM
Can you try replacing the statements in pgetd with:

!       Assign pointer, length, and precision

        if( pcomp(dname, dict(i), 5) ) then
          point =  np(dlist(i))
          lengt =  ipoint(i)
          prec  =  iprec(i)
          flag  = .true.
          return
        endif
Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: adil on December 18, 2015, 08:15:13 AM
i got build error:

.... feappv31\ver31\program\pgetd.f:60.19:
          point =  np(dlist(i))                                         
                   1
Error: Function 'np' at (1) has no IMPLICIT type
Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: adil on December 18, 2015, 08:18:53 AM
i added also   (    include  'pointer.h'   ) to resolve build problem
Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: adil on December 18, 2015, 08:44:02 AM
SOLVED;
thank you so much for the help :);
I have got now the coordinates but i have to offset the array index by -1 to get the the right sequence

    for(int32_t i = 0; i<25; i++)
    {
        double x = m_hr[m_point+2*i-1];
        double y = m_hr[m_point+2*i];
        values << "x = " << x << ", y = " << y << "\n";
    }

Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: Prof. R.L. Taylor on December 18, 2015, 11:18:48 AM
The offset is the difference between C indexing and Fortran ones -- so I am happy that things now work.  The routine never got updated when we changed memory management. So thank you for pointing to the error.
Title: Re: need help with FEAPpv pgetd to get mesh coordinates
Post by: adil on December 18, 2015, 11:55:04 AM
thank you again Prof. R.L. Taylor