1//this function generates the command-line options for the given solver 2//thus, passing in "0" (root solver) would generate the full command-line options 3//important: use option='newline' to display each option on a new line. use option='space' to put spaces in between the options (as if we were using the terminal). option is space by default. 4function getCmdOptions(data,endtag,prefix,option) 5{ 6 if(prefix == undefined) 7 prefix = ""; 8 9 var endl = ""; 10 if(option == "newline") 11 endl = "<br>"; 12 else if(option == "space") 13 endl = " "; 14 else 15 endl = " ";// use space by default 16 17 var ret = ""; 18 19 if(data[endtag] == undefined) 20 return ""; 21 22 ret += "-" + prefix + "pc_type " + data[endtag].pc_type + endl; 23 ret += "-" + prefix + "ksp_type " + data[endtag].ksp_type + endl; 24 25 var pc_type = data[endtag].pc_type; 26 27 if(pc_type == "mg") { //add extra info related to mg 28 ret += "-" + prefix + "pc_mg_type " + data[endtag].pc_mg_type + endl; 29 ret += "-" + prefix + "pc_mg_levels " + data[endtag].pc_mg_levels + endl; 30 } 31 else if(pc_type == "gamg") { 32 ret += "-" + prefix + "pc_gamg_type " + data[endtag].pc_gamg_type + endl; 33 ret += "-" + prefix + "pc_gamg_levels " + data[endtag].pc_gamg_levels + endl; 34 } 35 else if(pc_type == "fieldsplit") { 36 ret += "-" + prefix + "pc_fieldsplit_type " + data[endtag].pc_fieldsplit_type + endl; 37 ret += "-" + prefix + "pc_fieldsplit_blocks " + data[endtag].pc_fieldsplit_blocks + endl; 38 } 39 else if(pc_type == "bjacobi") { 40 ret += "-" + prefix + "pc_bjacobi_blocks " + data[endtag].pc_bjacobi_blocks + endl; 41 } 42 else if(pc_type == "asm") { 43 ret += "-" + prefix + "pc_asm_blocks " + data[endtag].pc_asm_blocks + endl; 44 ret += "-" + prefix + "pc_asm_overlap " + data[endtag].pc_asm_overlap + endl; 45 } 46 else if(pc_type == "redundant") { 47 ret += "-" + prefix + "pc_redundant_number " + data[endtag].pc_redundant_number + endl; 48 } 49 50 51 //then recursively handle all the children 52 var numChildren = getNumChildren(data,endtag); 53 54 //handle children recursively 55 for(var i=0; i<numChildren; i++) { 56 var childEndtag = endtag + "_" + i; 57 var childPrefix = ""; 58 59 //first determine appropriate prefix 60 if(pc_type == "mg") 61 childPrefix = "mg_levels_" + i + "_"; 62 if(pc_type == "gamg") 63 childPrefix = "gamg_levels_" + i + "_"; 64 else if(pc_type == "fieldsplit") 65 childPrefix = "fieldsplit_" + i + "_"; 66 else if(pc_type == "bjacobi") 67 childPrefix = "sub_"; 68 else if(pc_type == "asm") 69 childPrefix = "sub_"; 70 else if(pc_type == "redundant") 71 childPrefix = "redundant_"; 72 else if(pc_type == "ksp") 73 childPrefix = "sub_"; 74 75 ret += getCmdOptions(data,childEndtag,prefix+childPrefix,option); //recursive call 76 } 77 78 return ret; 79} 80 81//this function is used by tree.js to get a simple description of a given solver 82function getSimpleDescription(data,endtag) 83{ 84 var ret = ""; 85 var endl = "<br>"; 86 87 if(data[endtag] == undefined) 88 return ""; 89 90 ret += /*"ksp_type " +*/ data[endtag].ksp_type + endl; 91 ret += /*"pc_type " +*/ data[endtag].pc_type + endl; 92 93 /*var pc_type = data[endtag].pc_type; 94 95 if(pc_type == "mg") { //add extra info related to mg 96 ret += "pc_mg_type " + data[endtag].pc_mg_type + endl; 97 ret += "pc_mg_levels " + data[endtag].pc_mg_levels + endl; 98 } 99 else if(pc_type == "fieldsplit") { 100 ret += "pc_fieldsplit_type " + data[endtag].pc_fieldsplit_type + endl; 101 ret += "pc_fieldsplit_blocks " + data[endtag].pc_fieldsplit_blocks + endl; 102 } 103 else if(pc_type == "bjacobi") { 104 ret += "pc_bjacobi_blocks " + data[endtag].pc_bjacobi_blocks + endl; 105 } 106 else if(pc_type == "asm") { 107 ret += "pc_asm_blocks " + data[endtag].pc_asm_blocks + endl; 108 ret += "pc_asm_overlap " + data[endtag].pc_asm_overlap + endl; 109 } 110 else if(pc_type == "redundant") { 111 ret += "pc_redundant_number " + data[endtag].pc_redundant_number + endl; 112 }*/ 113 114 return ret; 115} 116