How to print values on gauss points
Line 15: | Line 15: | ||
void PfemContactElement3D::GetValueOnIntegrationPoints(const Variable<double>& rVariable, std::vector<double>& rValues, const ProcessInfo& rCurrentProcessInfo) { | void PfemContactElement3D::GetValueOnIntegrationPoints(const Variable<double>& rVariable, std::vector<double>& rValues, const ProcessInfo& rCurrentProcessInfo) { | ||
− | + | if (rVariable == CONTACT_STICK){ | |
− | + | for (unsigned int PointNumber = 0; PointNumber < 1; PointNumber++) { | |
− | + | rValues[PointNumber] = double(this->GetValue(IS_CONTACT_MASTER));}}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | Here '''rVariable''' can be any registered variable of KRATOS. '''rValues''' is always a vector that has the length of the number of Gauss points in each element. | |
+ | This vector is filled as is desired and then its values is printed in GID through the function '''PrintOnGaussPoints'''presented in step 1. |
Latest revision as of 08:33, 3 May 2012
Following steps are necessary to be abale to print values on Gauss points:
1. Call PrintOnGaussPoints function of the gid_io with the variable that you want to see, i.e CONTACT_STICK, to the python file
gid_io.PrintOnGaussPoints(CONTACT_STICK, self.model_part, time);
Note that the variable must be a double, a vector of doubles or a Matrix of doubles.
2. This function in his turn calls a function inside your element that is called GetValueOnIntegrationPoints.
This is an standard function of class of element and has 3 representatives for double, vector of doubles and Matrix of doubles.
One example of it can be found as ,
void PfemContactElement3D::GetValueOnIntegrationPoints(const Variable<double>& rVariable, std::vector<double>& rValues, const ProcessInfo& rCurrentProcessInfo) { if (rVariable == CONTACT_STICK){ for (unsigned int PointNumber = 0; PointNumber < 1; PointNumber++) { rValues[PointNumber] = double(this->GetValue(IS_CONTACT_MASTER));}}}
Here rVariable can be any registered variable of KRATOS. rValues is always a vector that has the length of the number of Gauss points in each element. This vector is filled as is desired and then its values is printed in GID through the function PrintOnGaussPointspresented in step 1.