public void update(particleSystem pS)
        {
            vector grad = FriedChiken.getGradient();
            vector load = FriedChiken.getLoad();

            System.Threading.Tasks.Parallel.For(0, elemList.Count, (i) =>
            {
                elements.element e = elemList[i];
                e.copyFrom(pS.particles);
                e.Update();
            }
                                                );

            for (int i = 0; i < elemList.Count; i++)
            {
                elements.element e = elemList[i];
                e.Merge(pS, grad, load, ref FriedChiken.energy);
            }
        }
        public void update(particleSystem pS)
        {
            vector r = FriedChiken.getResidual();
            matrix J = FriedChiken.getJacobian();

            currentVolume = 0;
            for (int i = 0; i < J.nCol; i++)
            {
                J[number, i] = 0;
            }
            for (int i = 0; i < (int)elemList.Count; i++)
            {
                elements.element e = elemList[i];
                e.copyFrom(pS.particles);
                e.Update();
                e.Merge(pS, J, this.number);
                currentVolume += e.Volume;
            }
            r[number] = currentVolume - refVolume;
        }