function gamma = adjointDesignMap(Ishape,p,v)

% gamma = adjointDesignMap(Ishape,p,v)
%                It applies a vector v to gradient
%                of the design-to-shape mapping.


% number of nodes on the symmetric part of shape design boundary
nSymmetryShapeNodes = max(size(Ishape));

% number of design variables
nSymmetryDesign = max(size(p));

% total number of design control nodes
nDesign = 2*nSymmetryDesign+1;

gamma = zeros(nSymmetryDesign,1);

d = 0.5/(nSymmetryShapeNodes-1);

for i=1:nSymmetryShapeNodes
    gamma(1) = gamma(1) + bezier(nSymmetryDesign+1,nDesign,0.5+(i-1)*d) * v(2*i-1);
    
    for j=2:nSymmetryDesign
        gamma(j) = gamma(j) + bezier(nSymmetryDesign+1+(j-1),nDesign,0.5+(i-1)*d) * v(2*i-1);
        gamma(j) = gamma(j) + bezier(nSymmetryDesign+1-(j-1),nDesign,0.5+(i-1)*d) * v(2*i-1);
    end
end
