00001 #include "sselnodes.h"
00002
00003 sselnodes::sselnodes (long nd,long kk,long *j)
00004 {
00005 long i;
00006
00007
00008 ndom=nd;
00009
00010
00011 nn = kk;
00012
00013
00014 nsn=0;
00015 for (i=0;i<nn;i++){
00016 if (j[i]>-1)
00017 nsn++;
00018 }
00019
00020 if (nsn==0){
00021 fprintf (stderr,"\n\n wrong number of selected nodes in constructor (file %s, line %d)\n",__FILE__,__LINE__);
00022
00023 }
00024
00025
00026 lsnl=new long [nsn];
00027
00028 lsng=new long [nsn];
00029
00030 k=0;
00031 for (i=0;i<nn;i++){
00032 if (j[i]>-1){
00033 lsnl[k]=i;
00034 lsng[k]=j[i];
00035 k++;
00036 }
00037 }
00038
00039 }
00040
00041 sselnodes::sselnodes (long nd,long *ii,long **jj)
00042 {
00043
00044 ndom=nd;
00045
00046 nsndom = new long [ndom];
00047 for (i=0;i<ndom;i++){
00048 nsndom[i]=ii[i];
00049 }
00050
00051 gnn = new long* [ndom];
00052 for (i=0;i<ndom;i++){
00053 gnn[i] = new long [nsndom[i]];
00054 }
00055
00056 for (i=0;i<ndom;i++){
00057 for (j=0;j<nsndom[i];j++){
00058 gnn[i][j]=jj[i][j];
00059 }
00060 }
00061
00062 }
00063
00064 sselnodes::~sselnodes ()
00065 {
00066 delete [] lsnl;
00067 delete [] lsng;
00068
00069 }
00070
00071
00072 void sselnodes::assemble_list_unknowns (gtopology *gt)
00073 {
00074 long i,j,k,l,ann,nu,ndofn;
00075
00076 if (ndofdom!=NULL){
00077 delete [] ndofdom;
00078 }
00079 ndofdom = new long [ndom];
00080
00081 maxnu=0;
00082 for (i=0;i<ndom;i++){
00083 nu=0;
00084 for (j=0;j<nsndom[i];j++){
00085
00086 ann=gnn[i][j];
00087
00088 ndofn = gt->give_ndofn (ann);
00089 for (k=0;k<ndofn;k++){
00090 l=gt->give_dof (ann,k);
00091 if (l>0)
00092 nu++;
00093 }
00094
00095 }
00096 ndofdom[i]=nu;
00097 if (nu>maxnu)
00098 maxnu=nu;
00099 }
00100
00101 if (cndom!=NULL){
00102 for (i=0;i<ndom;i++){
00103 delete [] cndom[i];
00104 }
00105 delete [] cndom;
00106 }
00107 cndom = new long* [ndom];
00108 for (i=0;i<ndom;i++){
00109 cndom[i] = new long [ndofdom[i]];
00110 }
00111
00112
00113 for (i=0;i<ndom;i++){
00114 ndofdom[i]=0;
00115 for (j=0;j<nsndom[i];j++){
00116
00117 ann=gnn[i][j];
00118
00119 ndofn = gt->give_ndofn (ann);
00120 for (k=0;k<ndofn;k++){
00121 l=gt->give_dof (ann,k);
00122 if (l>0){
00123 cndom[i][ndofdom[i]]=l;
00124 ndofdom[i]++;
00125 }
00126 }
00127
00128 }
00129 }
00130
00131 }