source: issm/trunk/src/c/modules/InputConvergencex/InputConvergencex.cpp@ 9761

Last change on this file since 9761 was 9761, checked in by Eric.Larour, 14 years ago

Added --with-control macro to configure script.
Can now strip out all control related routines from the parallel issm compilation.

File size: 1.5 KB
RevLine 
[4055]1/*!\file InputConvergencex
2 */
3
4#include "./InputConvergencex.h"
5#include "../../shared/shared.h"
6#include "../../include/include.h"
[9761]7#include "../../io/io.h"
[4055]8#include "../../toolkits/toolkits.h"
9#include "../../EnumDefinitions/EnumDefinitions.h"
10
[4778]11bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, double* criterionvalues,int num_criterionenums){
[4055]12
13 /*intermediary:*/
[4780]14 int i;
[4879]15 bool converged;
16 int num_notconverged=0;
17 int total_notconverged;
[4780]18 double *eps = NULL;
19 Element* element=NULL;
[4055]20
21 /*allocate dynamic memory: */
22 eps=(double*)xmalloc(num_criterionenums*sizeof(double));
23
24 /*Go through elements, and ask them to do the job: */
25 for(i=0;i<elements->Size();i++){
[4057]26 element=(Element*)elements->GetObjectByOffset(i);
[4879]27 converged=element->InputConvergence(eps,enums,num_enums,criterionenums,criterionvalues,num_criterionenums);
28 if(!converged) num_notconverged++;
[4055]29 }
30
31 /*In parallel, we need to gather the converged status: */
32 #ifdef _PARALLEL_
[4879]33 MPI_Allreduce ( (void*)&num_notconverged,(void*)&total_notconverged,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
[4890]34 num_notconverged=total_notconverged;
[4055]35 #endif
[6412]36 _printf_(VerboseConvergence()," #elements above convergence criterion = %i\n",num_notconverged);
[4055]37
38 /*Free ressources:*/
39 xfree((void**)&eps);
40
41 /*return: */
[4890]42 if (num_notconverged){
[4879]43 return false;}
44 else{
[4780]45 return true;}
[4055]46}
Note: See TracBrowser for help on using the repository browser.