function Invariant_sample=precal_generic_(gaussp,ini_Val)
%Calculating the values at gauss points
%
U = ini_Val.U;
p = ini_Val.p;
d = ini_Val.d;
a = U';
a(1:p)=[];
a(end-p+1:end)=[];
b=a;
a(length(a)) = [];
b(1) = [];

N=length(gaussp);
du=1/(N-1);
gweight=du;

Nshape = zeros(length(gaussp),(p+1));
dNsh = zeros(length(gaussp),(p+1));
ddNsh = zeros(length(gaussp),(p+1));
for i=1:length(gaussp)
        [Nsh,sp]=evaluate_BSp(U,p,d,gaussp(i));
        Nshape(i,:)=Nsh(1,:);
        dNsh(i,:)=Nsh(2,:);
        ddNsh(i,:)=Nsh(3,:);
        spv(i)=sp-p;
end

Invariant_sample.Nshape = Nshape;
Invariant_sample.dNsh = dNsh;
Invariant_sample.ddNsh = ddNsh;
Invariant_sample.spv = spv;
Invariant_sample.gaussp = gaussp;
Invariant_sample.gweight = gweight;
