95 int main(
int argc,
char** argv)
106 std::vector<std::string> stdstrings;
115 std::string solverName;
125 fei::console_out() <<
"Failed to find one or more required parameters in input-file."
136 int nodes = (L+1)*(L+1);
140 FEI_COUT <<
"\n========================================================\n";
142 FEI_COUT <<
"Square size L: " << L <<
" elements.\n";
143 FEI_COUT <<
"Global number of elements: " << L*L <<
"\n";
144 FEI_COUT <<
"Global number of nodes: " << nodes <<
"\n";
145 FEI_COUT <<
"Global number of equations: " << eqns <<
"\n";
146 FEI_COUT <<
"========================================================"
150 if (outputLevel == 1) {
169 catch (std::runtime_error& exc) {
177 if (factory.
get() == NULL) {
204 nodeSpace->
defineFields( numFields, fieldIDs, fieldSizes );
261 int err = solver->
solve(linSys.
get(),
263 paramset, itersTaken, status);
282 int lenNodeIDs = numNodes;
284 double* soln =
new double[lenNodeIDs];
285 if (nodeIDs != NULL && soln != NULL) {
287 nodeIDs, lenNodeIDs) );
291 numNodes, nodeIDs, soln));
293 for(
int i=0; i<numNodes; i++) {
294 int nID = (int)nodeIDs[i];
295 double x = (1.0* ((nID-1)%(L+1)))/L;
296 double y = (1.0* ((nID-1)/(L+1)))/L;
298 double exactSoln = x*x + y*y;
299 double error = std::abs(exactSoln - soln[i]);
300 if (maxErr < error) maxErr = error;
313 double globalMaxErr = 0.0;
314 MPI_Allreduce(&maxErr, &globalMaxErr, 1, MPI_DOUBLE, MPI_MAX, comm);
315 maxErr = globalMaxErr;
317 bool testPassed =
true;
318 if (maxErr > 1.e-6) testPassed =
false;
326 FEI_COUT <<
"Proc0 cpu times (seconds):" << FEI_ENDL
327 <<
" FEI initialize: " << fei_init_time << FEI_ENDL
328 <<
" FEI load: " << fei_load_time << FEI_ENDL
329 <<
" solve: " << solve_time << FEI_ENDL
330 <<
"Total program time: " << elapsed_cpu_time <<
FEI_ENDL;
333 if (testPassed && returnValue==0 &&
localProc == 0) {
335 FEI_COUT <<
"poisson: TEST PASSED, maxErr = " << maxErr <<
", iterations: "
339 if ((testPassed ==
false || returnValue != 0) &&
localProc == 0) {
340 FEI_COUT <<
"maxErr = " << maxErr <<
", TEST FAILED\n";
341 FEI_COUT <<
"(Test is deemed to have passed if the maximum difference"
342 <<
" between the exact and computed solutions is 1.e-6 or less, *AND*"
343 <<
" time-taken matches file-benchmark if available.)"
virtual void setMatrix(fei::SharedPtr< fei::Matrix > &matrix)
virtual fei::SharedPtr< fei::Solver > createSolver(const char *name=0)=0
virtual void setParameters(const fei::ParameterSet ¶ms)=0
fei::SharedPtr< fei::Factory > create_fei_Factory(MPI_Comm comm, const char *libraryName)
virtual int parameters(int numParams, const char *const *paramStrings)=0
virtual void parameters(const fei::ParameterSet ¶mset)
virtual int copyOutFieldData(int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)=0
virtual void setSolutionVector(fei::SharedPtr< fei::Vector > &soln)
virtual fei::SharedPtr< fei::LinearSystem > createLinearSystem(fei::SharedPtr< fei::MatrixGraph > &matrixGraph)
void defineFields(int numFields, const int *fieldIDs, const int *fieldSizes, const int *fieldTypes=NULL)
virtual void setRHS(fei::SharedPtr< fei::Vector > &rhs)
virtual int scatterToOverlap()=0
virtual int loadComplete(bool applyBCs=true, bool globalAssemble=true)=0
virtual fei::SharedPtr< VectorSpace > createVectorSpace(MPI_Comm, const char *name)
int init_elem_connectivities(FEI *fei, HexBeam &hexcube)
int load_elem_data(FEI *fei, HexBeam &hexcube)
int getStringParamValue(const char *name, std::string ¶mValue) const
int get_filename_and_read_input(int argc, char **argv, MPI_Comm comm, int localProc, std::vector< std::string > &stdstrings)
virtual int initComplete()=0
int set_shared_nodes(FEI *fei, PoissonData &poissonData)
int getOwnedAndSharedIDs(int idtype, int lenList, int *IDs, int &numOwnedAndSharedIDs)
void defineIDTypes(int numIDTypes, const int *idTypes)
int initialize_mpi(int argc, char **argv, int &localProc, int &numProcs)
virtual fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)=0
void print_args(int argc, char **argv)
std::ostream & console_out()
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
int load_BC_data(FEI *fei, HexBeam &hexcube)
int getNumOwnedAndSharedIDs(int idType)
int localProc(MPI_Comm comm)
virtual int solve(fei::LinearSystem *linearSystem, fei::Matrix *preconditioningMatrix, const fei::ParameterSet ¶meterSet, int &iterationsTaken, int &status)
virtual fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)=0
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)=0
int main(int argc, char **argv)
int numProcs(MPI_Comm comm)
int getIntParamValue(const char *name, int ¶mValue) const