53 |
for d1 in range(order+1): |
for d1 in range(order+1): |
54 |
for d2 in range(order+1): |
for d2 in range(order+1): |
55 |
for k in range(ncomps): |
for k in range(ncomps): |
56 |
out[k,d1,d2]=getRandom() |
if d1+d2<=order: out[k,d1,d2]=getRandom() |
57 |
if dim == 3: |
if dim == 3: |
58 |
out=numarray.zeros((ncomps,max_order+1,max_order+1,max_order+1)) |
out=numarray.zeros((ncomps,max_order+1,max_order+1,max_order+1)) |
59 |
for d1 in range(order+1): |
for d1 in range(order+1): |
60 |
for d2 in range(order+1): |
for d2 in range(order+1): |
61 |
for d3 in range(order+1): |
for d3 in range(order+1): |
62 |
for k in range(ncomps): |
for k in range(ncomps): |
63 |
out[k,d1,d2,d3]=getRandom() |
if d1+d2+d3<=order: out[k,d1,d2,d3]=getRandom() |
64 |
return out |
return out |
65 |
|
|
66 |
def makeGradient(func,dim): |
def makeGradient(func,dim): |
417 |
func_i="ReducedFunction" |
func_i="ReducedFunction" |
418 |
for case in ["Const", "Vario" ]: |
for case in ["Const", "Vario" ]: |
419 |
for solo in [1, 2 ]: |
for solo in [1, 2 ]: |
|
order=solo |
|
420 |
if typ in ["Strong","Weak"]: |
if typ in ["Strong","Weak"]: |
421 |
# coefficient A: |
# coefficient A: |
422 |
|
if case=="Vario" and typ=="Weak": |
423 |
|
order=solo |
424 |
|
else: |
425 |
|
order=solo |
426 |
if s==1: |
if s==1: |
427 |
for i in range(d): |
for i in range(d): |
428 |
for j in range(d): |
for j in range(d): |
474 |
makeTitle(d,coffo,solo,s,"A",case,typ,body2,mark="%s%s%s%s"%(p,i,q,j),pdeargs=args) |
makeTitle(d,coffo,solo,s,"A",case,typ,body2,mark="%s%s%s%s"%(p,i,q,j),pdeargs=args) |
475 |
# coefficient B: |
# coefficient B: |
476 |
if typ in ["Strong","Weak"] or coffo=="Full": |
if typ in ["Strong","Weak"] or coffo=="Full": |
477 |
|
if case=="Vario" and typ=="Weak": |
478 |
|
order=solo-1 |
479 |
|
else: |
480 |
|
order=solo |
481 |
if s==1: |
if s==1: |
482 |
for i in range(d): |
for i in range(d): |
483 |
test_func=makeTestSolution(order,s,d) |
test_func=makeTestSolution(order,s,d) |
537 |
makeTitle(d,coffo,solo,s,"B",case,typ,body2,mark="%s%s%s"%(p,i,q),pdeargs=args) |
makeTitle(d,coffo,solo,s,"B",case,typ,body2,mark="%s%s%s"%(p,i,q),pdeargs=args) |
538 |
if typ=="Strong": |
if typ=="Strong": |
539 |
# coefficient C: |
# coefficient C: |
540 |
|
order=solo |
541 |
if s==1: |
if s==1: |
542 |
for j in range(d): |
for j in range(d): |
543 |
test_func=makeTestSolution(order,s,d) |
test_func=makeTestSolution(order,s,d) |
573 |
body2+=makeFunctionText(C_x_grad,d,"Y_test") |
body2+=makeFunctionText(C_x_grad,d,"Y_test") |
574 |
makeTitle(d,coffo,solo,s,"C",case,typ,body2,mark="%s%s%s"%(p,q,j),pdeargs=args) |
makeTitle(d,coffo,solo,s,"C",case,typ,body2,mark="%s%s%s"%(p,q,j),pdeargs=args) |
575 |
# coefficient D: |
# coefficient D: |
576 |
|
if case=="Vario": |
577 |
|
order=solo-1 |
578 |
|
else: |
579 |
|
order=solo |
580 |
if s==1: |
if s==1: |
581 |
if case == "Const" : |
test_func=makeTestSolution(order,s,d) |
|
test_func=makeTestSolution(order,s,d) |
|
|
else: |
|
|
test_func=makeTestSolution(order-1,s,d) |
|
582 |
body2=makeFunctionText(test_func,d,"u") |
body2=makeFunctionText(test_func,d,"u") |
583 |
if case == "Const" : |
if case == "Const" : |
584 |
f=int(8*random.random())+1 |
f=int(8*random.random())+1 |
593 |
else: |
else: |
594 |
for p in range(s): |
for p in range(s): |
595 |
for q in range(s): |
for q in range(s): |
596 |
if case == "Const" : |
test_func=makeTestSolution(order,s,d) |
|
test_func=makeTestSolution(order,s,d) |
|
|
else: |
|
|
test_func=makeTestSolution(order-1,s,d) |
|
597 |
body2=makeFunctionText(test_func,d,"u") |
body2=makeFunctionText(test_func,d,"u") |
598 |
body2+=2*intend+"D_test=Data(0.,(%d,%d),%s(self.domain))\n"%(s,s,func_i) |
body2+=2*intend+"D_test=Data(0.,(%d,%d),%s(self.domain))\n"%(s,s,func_i) |
599 |
if case == "Const" : |
if case == "Const" : |
607 |
body2+=makeFunctionText(D,d,"Y_test") |
body2+=makeFunctionText(D,d,"Y_test") |
608 |
makeTitle(d,coffo,solo,s,"D",case,typ,body2,mark="%s%s"%(p,q),pdeargs=args) |
makeTitle(d,coffo,solo,s,"D",case,typ,body2,mark="%s%s"%(p,q),pdeargs=args) |
609 |
if coffo=="Full": |
if coffo=="Full": |
610 |
|
if case=="Vario": |
611 |
|
order=solo-1 |
612 |
|
else: |
613 |
|
order=solo |
614 |
# coefficient d: |
# coefficient d: |
615 |
if typ == "Strong": |
if typ == "Strong": |
616 |
if s==1: |
if s==1: |
617 |
if case == "Const" : |
test_func=makeTestSolution(order,s,d) |
|
test_func=makeTestSolution(order,s,d) |
|
|
else: |
|
|
test_func=makeTestSolution(order-1,s,d) |
|
618 |
body2=makeFunctionText(test_func,d,"u") |
body2=makeFunctionText(test_func,d,"u") |
619 |
if case == "Const" : |
if case == "Const" : |
620 |
f=int(8*random.random())+1 |
f=int(8*random.random())+1 |
629 |
else: |
else: |
630 |
for p in range(s): |
for p in range(s): |
631 |
for q in range(s): |
for q in range(s): |
632 |
if case == "Const" : |
test_func=makeTestSolution(order,s,d) |
|
test_func=makeTestSolution(order,s,d) |
|
|
else: |
|
|
test_func=makeTestSolution(order-1,s,d) |
|
633 |
body2=makeFunctionText(test_func,d,"u") |
body2=makeFunctionText(test_func,d,"u") |
634 |
body2+=2*intend+"d_test=Data(0.,(%d,%d),FunctionOnBoundary(self.domain))\n"%(s,s) |
body2+=2*intend+"d_test=Data(0.,(%d,%d),FunctionOnBoundary(self.domain))\n"%(s,s) |
635 |
if case == "Const" : |
if case == "Const" : |
645 |
makeTitle(d,coffo,solo,s,"d",case,typ,body2,mark="%s%s"%(p,q),pdeargs=args) |
makeTitle(d,coffo,solo,s,"d",case,typ,body2,mark="%s%s"%(p,q),pdeargs=args) |
646 |
# coefficient d_contact: |
# coefficient d_contact: |
647 |
if typ == "Contact": |
if typ == "Contact": |
648 |
|
if case=="Vario": |
649 |
|
order=solo-1 |
650 |
|
else: |
651 |
|
order=solo |
652 |
if s==1: |
if s==1: |
653 |
if case == "Const" : |
test_func=makeTestSolution(order,s,d) |
|
test_func=makeTestSolution(order,s,d) |
|
|
else: |
|
|
test_func=makeTestSolution(order-1,s,d) |
|
|
|
|
654 |
body2=makeFunctionText(test_func,d,"u",add_jump=True) |
body2=makeFunctionText(test_func,d,"u",add_jump=True) |
655 |
if case == "Const" : |
if case == "Const" : |
656 |
f=int(8*random.random())+1 |
f=int(8*random.random())+1 |
665 |
else: |
else: |
666 |
for p in range(s): |
for p in range(s): |
667 |
for q in range(s): |
for q in range(s): |
668 |
if case == "Const" : |
test_func=makeTestSolution(order,s,d) |
|
test_func=makeTestSolution(order,s,d) |
|
|
else: |
|
|
test_func=makeTestSolution(order-1,s,d) |
|
|
|
|
669 |
body2=makeFunctionText(test_func,d,"u",add_jump=True) |
body2=makeFunctionText(test_func,d,"u",add_jump=True) |
670 |
body2+=2*intend+"d_contact_test=Data(0.,(%d,%d),FunctionOnContactZero(self.domain))\n"%(s,s) |
body2+=2*intend+"d_contact_test=Data(0.,(%d,%d),FunctionOnContactZero(self.domain))\n"%(s,s) |
671 |
if case == "Const" : |
if case == "Const" : |
691 |
print "class Test_assemblage_2Do1_Contact(unittest.TestCase):" |
print "class Test_assemblage_2Do1_Contact(unittest.TestCase):" |
692 |
print t_prog["2Do1_contact"] |
print t_prog["2Do1_contact"] |
693 |
|
|
694 |
#print "class Test_assemblage_2Do2(unittest.TestCase):" |
print "class Test_assemblage_2Do2(unittest.TestCase):" |
695 |
#print t_prog["2Do2"] |
print t_prog["2Do2"] |
696 |
#print "class Test_assemblage_2Do2_Reduced(unittest.TestCase):" |
print "class Test_assemblage_2Do2_Reduced(unittest.TestCase):" |
697 |
#print t_prog["2Do2_reduced"] |
print t_prog["2Do2_reduced"] |
698 |
#print "class Test_assemblage_2Do2_Contact(unittest.TestCase):" |
print "class Test_assemblage_2Do2_Contact(unittest.TestCase):" |
699 |
#print t_prog["2Do2_contact"] |
print t_prog["2Do2_contact"] |
700 |
|
|
701 |
#print "class Test_assemblage_3Do1(unittest.TestCase):" |
print "class Test_assemblage_3Do1(unittest.TestCase):" |
702 |
#print t_prog["3Do1"] |
print t_prog["3Do1"] |
703 |
#print "class Test_assemblage_3Do1_Reduced(unittest.TestCase):" |
print "class Test_assemblage_3Do1_Reduced(unittest.TestCase):" |
704 |
#print t_prog["3Do1_reduced"] |
print t_prog["3Do1_reduced"] |
705 |
#print "class Test_assemblage_3Do1_Contact(unittest.TestCase):" |
print "class Test_assemblage_3Do1_Contact(unittest.TestCase):" |
706 |
#print t_prog["3Do1_contact"] |
print t_prog["3Do1_contact"] |
707 |
|
|
708 |
#print "class Test_assemblage_3Do2(unittest.TestCase):" |
print "class Test_assemblage_3Do2(unittest.TestCase):" |
709 |
#print t_prog["3Do2"] |
print t_prog["3Do2"] |
710 |
#print "class Test_assemblage_3Do2_Reduced(unittest.TestCase):" |
print "class Test_assemblage_3Do2_Reduced(unittest.TestCase):" |
711 |
#print t_prog["3Do2_reduced"] |
print t_prog["3Do2_reduced"] |
712 |
#print "class Test_assemblage_3Do2_contact(unittest.TestCase):" |
print "class Test_assemblage_3Do2_contact(unittest.TestCase):" |
713 |
#print t_prog["3Do2_contact"] |
print t_prog["3Do2_contact"] |
714 |
|
|
715 |
|
|
716 |
print "from esys.escript import *" |
print "from esys.escript import *" |