MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / ContactIntegrator

Method ContactIntegrator

comp/contact.cpp:671–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669 }
670
671 ContactIntegrator::ContactIntegrator(shared_ptr<CoefficientFunction> _cf,
672 bool _deformed)
673 : cf(_cf), deformed(_deformed)
674 {
675 cf->TraverseTree
676 ([&](CoefficientFunction& nodecf)
677 {
678 auto proxy = dynamic_cast<ProxyFunction*>(&nodecf);
679 if (proxy && !proxy->IsTestFunction() && !trial_proxies.Contains(proxy))
680 trial_proxies.Append(proxy);
681
682 if(proxy && proxy->IsTestFunction() && !test_proxies.Contains(proxy))
683 test_proxies.Append(proxy);
684
685 auto gf = dynamic_cast<GridFunction*>(&nodecf);
686 if (gf && !cf_gridfunctions.Contains(&nodecf))
687 cf_gridfunctions.Append(&nodecf);
688 });
689 if(trial_proxies.Size())
690 fes = trial_proxies[0]->GetFESpace();
691 else
692 {
693 if (test_proxies.Size())
694 fes = test_proxies[0]->GetFESpace();
695 else
696 throw Exception("No trial or test function found in ContactIntegrator");
697 }
698
699 dcf_dtest.SetSize(test_proxies.Size());
700 ddcf_dtest_dtrial.SetSize(test_proxies.Size(), trial_proxies.Size());
701 for (int i = 0; i < test_proxies.Size(); i++)
702 {
703 try
704 {
705 CoefficientFunction::T_DJC cache;
706 dcf_dtest[i] = cf->DiffJacobi(test_proxies[i], cache);
707 }
708 catch (const Exception& e)
709 {
710 cout << IM(5) << "dcf_dtest has thrown exception " << e.What() << endl;
711 }
712 for (auto j : Range(trial_proxies))
713 {
714 if (dcf_dtest[i])
715 try
716 {
717 CoefficientFunction::T_DJC cache2;
718 ddcf_dtest_dtrial(i, j) = dcf_dtest[i]->DiffJacobi(trial_proxies[j], cache2);
719 }
720 catch (const Exception& e)
721 {
722 cout << IM(1) << "ddcf_dtest_dtrial has thrown exception " << e.What() << endl;
723 }
724 }
725 }
726
727 }
728

Callers

nothing calls this directly

Calls 9

IMClass · 0.85
ContainsMethod · 0.80
GetFESpaceMethod · 0.80
RangeFunction · 0.50
TraverseTreeMethod · 0.45
AppendMethod · 0.45
SizeMethod · 0.45
SetSizeMethod · 0.45
DiffJacobiMethod · 0.45

Tested by

no test coverage detected